diff --git a/src/geometry.ts b/src/geometry.ts index 58abec9..abd0c9a 100644 --- a/src/geometry.ts +++ b/src/geometry.ts @@ -1,5 +1,5 @@ -import { Vector2D } from "./vector.js" -import * as shape from "./shapes.js" +/// +/// function loadScript(filepath: string): string { @@ -76,8 +76,8 @@ class Geometry extends HTMLElement private redraw() { - shape.line(this.context, new Vector2D(), new Vector2D(300, 300)); - shape.circle(this.context, new 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 174eaab..3f2ef5f 100644 --- a/src/shapeStyle.ts +++ b/src/shapeStyle.ts @@ -1,5 +1,4 @@ - -export class ShapeStyle +class ShapeStyle { public strokeWidth: number; public strokeColor: string; diff --git a/src/shapes.ts b/src/shapes.ts index 29454ff..374e40f 100644 --- a/src/shapes.ts +++ b/src/shapes.ts @@ -1,7 +1,7 @@ -import { Vector2D } from "./vector.js" -import { ShapeStyle } from "./shapeStyle.js"; +/// +/// -export function line(ctx: CanvasRenderingContext2D, from: Vector2D , to: Vector2D, style: ShapeStyle = new ShapeStyle()) +function line(ctx: CanvasRenderingContext2D, from: Vector2D , to: Vector2D, style: ShapeStyle = new ShapeStyle()) { ctx.beginPath(); ctx.moveTo(from.x, from.y); @@ -12,7 +12,7 @@ export function line(ctx: CanvasRenderingContext2D, from: Vector2D , to: Vector2 ctx.stroke(); } -export function circle(ctx: CanvasRenderingContext2D, center: Vector2D, radius: number, style: ShapeStyle = new ShapeStyle()) +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); diff --git a/src/vector.ts b/src/vector.ts index 699eb8e..64a8fdb 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -1,4 +1,4 @@ -export class Vector2D +class Vector2D { public x: number; public y: number; diff --git a/tsconfig.json b/tsconfig.json index 90de336..2adc248 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,7 @@ { "compilerOptions": { "target": "es6", - // "outFile": "./out/lauchpioos.js", - "outDir": "./out", + "outFile": "./out/geometry.js", "sourceRoot": "./src", "rootDir": "./src", "sourceMap": true