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"
import * as shape from "./shapes.js"
/// <reference path="vector.ts" />
/// <reference path="shapes.ts" />
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);
}
}

View file

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

View file

@ -1,7 +1,7 @@
import { Vector2D } from "./vector.js"
import { ShapeStyle } from "./shapeStyle.js";
/// <reference path="vector.ts" />
/// <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.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);

View file

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

View file

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