merge all ts files into one js file

This commit is contained in:
Lauchmelder 2021-11-27 05:36:37 +01:00
parent b010bf60ee
commit 04b3c0c2ca
5 changed files with 11 additions and 13 deletions

View file

@ -1,5 +1,5 @@
import { Vector2D } from "./vector.js" /// <reference path="vector.ts" />
import * as shape from "./shapes.js" /// <reference path="shapes.ts" />
function loadScript(filepath: string): string function loadScript(filepath: string): string
{ {
@ -76,8 +76,8 @@ class Geometry extends HTMLElement
private redraw() private redraw()
{ {
shape.line(this.context, new Vector2D(), new Vector2D(300, 300)); line(this.context, new Vector2D(), new Vector2D(300, 300));
shape.circle(this.context, new Vector2D(150, 150), 100); circle(this.context, new Vector2D(150, 150), 100);
} }
} }

View file

@ -1,5 +1,4 @@
class ShapeStyle
export class ShapeStyle
{ {
public strokeWidth: number; public strokeWidth: number;
public strokeColor: string; public strokeColor: string;

View file

@ -1,7 +1,7 @@
import { Vector2D } from "./vector.js" /// <reference path="vector.ts" />
import { ShapeStyle } from "./shapeStyle.js"; /// <reference path="shapeStyle.ts" />
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.beginPath();
ctx.moveTo(from.x, from.y); ctx.moveTo(from.x, from.y);
@ -12,7 +12,7 @@ export function line(ctx: CanvasRenderingContext2D, from: Vector2D , to: Vector2
ctx.stroke(); 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.beginPath();
ctx.arc(center.x, center.y, radius, 0, 2 * Math.PI, false); ctx.arc(center.x, center.y, radius, 0, 2 * Math.PI, false);

View file

@ -1,4 +1,4 @@
export class Vector2D class Vector2D
{ {
public x: number; public x: number;
public y: number; public y: number;

View file

@ -1,8 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es6",
// "outFile": "./out/lauchpioos.js", "outFile": "./out/geometry.js",
"outDir": "./out",
"sourceRoot": "./src", "sourceRoot": "./src",
"rootDir": "./src", "rootDir": "./src",
"sourceMap": true "sourceMap": true