diff --git a/src/geometry.ts b/src/geometry.ts
index b1f3932..63f76b6 100644
--- a/src/geometry.ts
+++ b/src/geometry.ts
@@ -1,3 +1,6 @@
+///
+///
+
function loadScript(filepath: string): string
{
let result = null;
@@ -73,8 +76,8 @@ class Geometry extends HTMLElement
private redraw()
{
- Shape.line(this.context, new Util.Vector2D(), new Util.Vector2D(300, 300));
- Shape.circle(this.context, new Util.Vector2D(150, 150), 100);
+ line(this.context, new Vector2D(), new Vector2D(300, 300));
+ circle(this.context, new Vector2D(150, 150), 100);
}
}
diff --git a/src/shapeStyle.ts b/src/shapeStyle.ts
index dabedcf..3f2ef5f 100644
--- a/src/shapeStyle.ts
+++ b/src/shapeStyle.ts
@@ -1,16 +1,13 @@
-module Util
+class ShapeStyle
{
- export class ShapeStyle
- {
- public strokeWidth: number;
- public strokeColor: string;
- public fillColor: string;
+ public strokeWidth: number;
+ public strokeColor: string;
+ public fillColor: string;
- constructor()
- {
- this.strokeWidth = 1;
- this.strokeColor = '#000000';
- this.fillColor = '#00000000';
- }
+ constructor()
+ {
+ this.strokeWidth = 1;
+ this.strokeColor = '#000000';
+ this.fillColor = '#00000000';
}
}
\ No newline at end of file
diff --git a/src/shapes.ts b/src/shapes.ts
index c79f31a..374e40f 100644
--- a/src/shapes.ts
+++ b/src/shapes.ts
@@ -1,26 +1,26 @@
-module Shape
+///
+///
+
+function line(ctx: CanvasRenderingContext2D, from: Vector2D , to: Vector2D, style: ShapeStyle = new ShapeStyle())
{
- export function line(ctx: CanvasRenderingContext2D, from: Util.Vector2D , to: Util.Vector2D, style: Util.ShapeStyle = new Util.ShapeStyle())
- {
- ctx.beginPath();
- ctx.moveTo(from.x, from.y);
- ctx.lineTo(to.x, to.y);
+ ctx.beginPath();
+ ctx.moveTo(from.x, from.y);
+ ctx.lineTo(to.x, to.y);
- ctx.lineWidth = style.strokeWidth;
- ctx.strokeStyle = style.strokeColor;
- ctx.stroke();
- }
+ ctx.lineWidth = style.strokeWidth;
+ ctx.strokeStyle = style.strokeColor;
+ ctx.stroke();
+}
- export function circle(ctx: CanvasRenderingContext2D, center: Util.Vector2D, radius: number, style: Util.ShapeStyle = new Util.ShapeStyle())
- {
- ctx.beginPath();
- ctx.arc(center.x, center.y, radius, 0, 2 * Math.PI, false);
+function circle(ctx: CanvasRenderingContext2D, center: Vector2D, radius: number, style: ShapeStyle = new ShapeStyle())
+{
+ ctx.beginPath();
+ ctx.arc(center.x, center.y, radius, 0, 2 * Math.PI, false);
- ctx.fillStyle = style.fillColor;
- ctx.fill();
-
- ctx.lineWidth = style.strokeWidth;
- ctx.strokeStyle = style.strokeColor;
- ctx.stroke();
- }
+ ctx.fillStyle = style.fillColor;
+ ctx.fill();
+
+ ctx.lineWidth = style.strokeWidth;
+ ctx.strokeStyle = style.strokeColor;
+ ctx.stroke();
}
\ No newline at end of file
diff --git a/src/vector.ts b/src/vector.ts
index 510867e..64a8fdb 100644
--- a/src/vector.ts
+++ b/src/vector.ts
@@ -1,14 +1,11 @@
-module Util
+class Vector2D
{
- export class Vector2D
+ public x: number;
+ public y: number;
+
+ constructor(x: number = 0, y: number = 0)
{
- public x: number;
- public y: number;
-
- constructor(x: number = 0, y: number = 0)
- {
- this.x = x;
- this.y = y;
- }
+ this.x = x;
+ this.y = y;
}
}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 2ad2c5c..2adc248 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,7 +2,6 @@
"compilerOptions": {
"target": "es6",
"outFile": "./out/geometry.js",
- "outDir": "./out",
"sourceRoot": "./src",
"rootDir": "./src",
"sourceMap": true