added missing types

This commit is contained in:
jusax23 2023-06-22 17:50:11 +02:00
parent 6156fac496
commit 99658a631a
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
4 changed files with 16 additions and 16 deletions

View file

@ -1,9 +1,9 @@
import { HTMLappendIt, Positionable, svgNamespace } from "../types"; import { HTMLappendIt, Positionable, svgNamespace } from "../types";
export class SVGArrow implements HTMLappendIt { export class SVGArrow implements HTMLappendIt {
group; group: SVGElement;
lineText; lineText: SVGElement;
line; line: SVGElement;
from: Positionable; from: Positionable;
to: Positionable; to: Positionable;
constructor(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); let l = Math.sqrt(dx * dx + dy * dy);
dx /= l; dx /= l;
dy /= l; dy /= l;
this.line.setAttribute('x1', this.from.x + dx * 30); this.line.setAttribute('x1', (this.from.x + dx * 30) + "");
this.line.setAttribute('y1', this.from.y + dy * 30); this.line.setAttribute('y1', (this.from.y + dy * 30) + "");
this.line.setAttribute('x2', this.to.x - dx * 40); this.line.setAttribute('x2', (this.to.x - dx * 40) + "");
this.line.setAttribute('y2', this.to.y - dy * 40); this.line.setAttribute('y2', (this.to.y - dy * 40) + "");
} }
appendIt(svg) { appendIt(svg) {
svg.appendChild(this.group); svg.appendChild(this.group);

View file

@ -2,10 +2,10 @@ import { HTMLappendIt, svgNamespace } from "../types";
import { Tragable } from "./tragable"; import { Tragable } from "./tragable";
export class SVGNode extends Tragable implements HTMLappendIt { export class SVGNode extends Tragable implements HTMLappendIt {
group; group: SVGElement;
circle; circle: SVGElement;
circleText; circleText: SVGElement;
aboveText; aboveText: SVGElement;
constructor(node) { constructor(node) {
super(); super();
// Create the group element // Create the group element

View file

@ -2,9 +2,9 @@ import { HTMLappendIt, svgNamespace } from "../types";
import { Tragable } from "./tragable"; import { Tragable } from "./tragable";
export class SVGTRansition extends Tragable implements HTMLappendIt { export class SVGTRansition extends Tragable implements HTMLappendIt {
group; group: SVGElement;
rect; rect: SVGElement;
rectText; rectText: SVGElement;
constructor(trans) { constructor(trans) {
super(); super();
// Create the group element // Create the group element

View file

@ -29,10 +29,10 @@ export class Tragable {
}); });
} }
onMove(cb) { onMove(cb: (event: MouseEvent) => any) {
this.#moveCB = cb; this.#moveCB = cb;
} }
onClick(cb) { onClick(cb: (event: MouseEvent) => any) {
this.#clickCB = cb; this.#clickCB = cb;
} }
} }