fix source and target updates
This commit is contained in:
parent
fb3895e0d4
commit
fabc27200c
|
|
@ -31,6 +31,7 @@
|
||||||
<body>
|
<body>
|
||||||
<folk-shape id="box1" x="50" y="100" width="50" height="50"></folk-shape>
|
<folk-shape id="box1" x="50" y="100" width="50" height="50"></folk-shape>
|
||||||
<folk-shape id="box2" x="150" y="300" width="50" height="50"></folk-shape>
|
<folk-shape id="box2" x="150" y="300" width="50" height="50"></folk-shape>
|
||||||
|
<folk-shape id="box3" x="200" y="200" width="50" height="50"></folk-shape>
|
||||||
<folk-arrow source="#box1" target="#box2"></folk-arrow>
|
<folk-arrow source="#box1" target="#box2"></folk-arrow>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,12 @@ export class FolkArrow extends FolkBaseConnection {
|
||||||
|
|
||||||
if (sourceRect === null || targetRect === null) {
|
if (sourceRect === null || targetRect === null) {
|
||||||
this.style.clipPath = '';
|
this.style.clipPath = '';
|
||||||
|
this.style.display = 'none';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.style.display = 'block';
|
||||||
|
|
||||||
const [sx, sy, cx, cy, ex, ey] = getBoxToBoxArrow(
|
const [sx, sy, cx, cy, ex, ey] = getBoxToBoxArrow(
|
||||||
sourceRect.x,
|
sourceRect.x,
|
||||||
sourceRect.y,
|
sourceRect.y,
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ export class FolkBaseConnection extends FolkElement {
|
||||||
this.unobserveTarget();
|
this.unobserveTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
override update(changedProperties: PropertyValues<this>) {
|
override willUpdate(changedProperties: PropertyValues<this>) {
|
||||||
super.update(changedProperties);
|
super.willUpdate(changedProperties);
|
||||||
|
|
||||||
if (changedProperties.has('source')) {
|
if (changedProperties.has('source')) {
|
||||||
this.observeSource();
|
this.observeSource();
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,10 @@ to.${key} = ${value};`);
|
||||||
}
|
}
|
||||||
|
|
||||||
#evaluateExpression = (event?: Event) => {
|
#evaluateExpression = (event?: Event) => {
|
||||||
console.log('eval');
|
|
||||||
if (this.sourceElement === null || this.targetElement === null) return;
|
if (this.sourceElement === null || this.targetElement === null) return;
|
||||||
|
|
||||||
this.stroke = 'black';
|
this.stroke = 'black';
|
||||||
|
|
||||||
if (!this.#function) return;
|
if (!this.#function) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue