|
@ -133,8 +133,16 @@ class BezierEdgeDynamic extends BezierEdgeBase { |
|
|
*/ |
|
|
*/ |
|
|
getPoint(percentage, viaNode = this.via) { |
|
|
getPoint(percentage, viaNode = this.via) { |
|
|
let t = percentage; |
|
|
let t = percentage; |
|
|
let x = Math.pow(1 - t, 2) * this.fromPoint.x + (2 * t * (1 - t)) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; |
|
|
|
|
|
let y = Math.pow(1 - t, 2) * this.fromPoint.y + (2 * t * (1 - t)) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; |
|
|
|
|
|
|
|
|
let x, y; |
|
|
|
|
|
if (this.from === this.to){ |
|
|
|
|
|
let [cx,cy,cr] = this._getCircleData(this.from) |
|
|
|
|
|
let a = 2 * Math.PI * (1 - t); |
|
|
|
|
|
x = cx + cr * Math.sin(a); |
|
|
|
|
|
y = cy + cr - cr * (1 - Math.cos(a)); |
|
|
|
|
|
} else { |
|
|
|
|
|
x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; |
|
|
|
|
|
y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return {x: x, y: y}; |
|
|
return {x: x, y: y}; |
|
|
} |
|
|
} |
|
@ -151,4 +159,4 @@ class BezierEdgeDynamic extends BezierEdgeBase { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default BezierEdgeDynamic; |
|
|
|
|
|
|
|
|
export default BezierEdgeDynamic; |