fsm-designer/js/components/temporary-connection.js

22 lines
445 B
JavaScript

class TemporaryConnection {
constructor(from, to) {
this.from = from;
this.to = to;
}
draw() {
ctx.beginPath();
ctx.strokeStyle = '#000';
ctx.fillStyle = '#000';
ctx.moveTo(this.to.x, this.to.y);
ctx.lineTo(this.from.x, this.from.y);
ctx.stroke();
ctx.drawArrow(this.to.x, this.to.y, Math.atan2(this.to.y - this.from.y, this.to.x - this.from.x));
}
}