diff --git a/js/graphics/SVGArrow.ts b/js/graphics/SVGArrow.ts index 43ff977..2bda327 100644 --- a/js/graphics/SVGArrow.ts +++ b/js/graphics/SVGArrow.ts @@ -1,9 +1,9 @@ import { HTMLappendIt, Positionable, svgNamespace } from "../types"; export class SVGArrow implements HTMLappendIt { - group; - lineText; - line; + group: SVGElement; + lineText: SVGElement; + line: SVGElement; from: Positionable; to: Positionable; constructor(from: Positionable, to: Positionable) { @@ -34,10 +34,10 @@ export class SVGArrow implements HTMLappendIt { let l = Math.sqrt(dx * dx + dy * dy); dx /= l; dy /= l; - this.line.setAttribute('x1', this.from.x + dx * 30); - this.line.setAttribute('y1', this.from.y + dy * 30); - this.line.setAttribute('x2', this.to.x - dx * 40); - this.line.setAttribute('y2', this.to.y - dy * 40); + this.line.setAttribute('x1', (this.from.x + dx * 30) + ""); + this.line.setAttribute('y1', (this.from.y + dy * 30) + ""); + this.line.setAttribute('x2', (this.to.x - dx * 40) + ""); + this.line.setAttribute('y2', (this.to.y - dy * 40) + ""); } appendIt(svg) { svg.appendChild(this.group); diff --git a/js/graphics/SVGNode.ts b/js/graphics/SVGNode.ts index a8db426..68d8447 100644 --- a/js/graphics/SVGNode.ts +++ b/js/graphics/SVGNode.ts @@ -2,10 +2,10 @@ import { HTMLappendIt, svgNamespace } from "../types"; import { Tragable } from "./tragable"; export class SVGNode extends Tragable implements HTMLappendIt { - group; - circle; - circleText; - aboveText; + group: SVGElement; + circle: SVGElement; + circleText: SVGElement; + aboveText: SVGElement; constructor(node) { super(); // Create the group element diff --git a/js/graphics/SVGTransition.ts b/js/graphics/SVGTransition.ts index c3fcf2f..c0b8df2 100644 --- a/js/graphics/SVGTransition.ts +++ b/js/graphics/SVGTransition.ts @@ -2,9 +2,9 @@ import { HTMLappendIt, svgNamespace } from "../types"; import { Tragable } from "./tragable"; export class SVGTRansition extends Tragable implements HTMLappendIt { - group; - rect; - rectText; + group: SVGElement; + rect: SVGElement; + rectText: SVGElement; constructor(trans) { super(); // Create the group element diff --git a/js/graphics/tragable.ts b/js/graphics/tragable.ts index e1e6849..458fceb 100644 --- a/js/graphics/tragable.ts +++ b/js/graphics/tragable.ts @@ -29,10 +29,10 @@ export class Tragable { }); } - onMove(cb) { + onMove(cb: (event: MouseEvent) => any) { this.#moveCB = cb; } - onClick(cb) { + onClick(cb: (event: MouseEvent) => any) { this.#clickCB = cb; } } \ No newline at end of file