|
@ -91,7 +91,13 @@ class EdgeBase { |
|
|
ctx.moveTo(this.from.x, this.from.y); |
|
|
ctx.moveTo(this.from.x, this.from.y); |
|
|
ctx.lineTo(this.to.x, this.to.y); |
|
|
ctx.lineTo(this.to.x, this.to.y); |
|
|
} |
|
|
} |
|
|
|
|
|
// draw shadow if enabled
|
|
|
|
|
|
this.enableShadow(ctx); |
|
|
|
|
|
|
|
|
ctx.stroke(); |
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
|
|
|
|
// disable shadows for other elements.
|
|
|
|
|
|
this.disableShadow(ctx); |
|
|
} |
|
|
} |
|
|
return via; |
|
|
return via; |
|
|
} |
|
|
} |
|
@ -310,10 +316,16 @@ class EdgeBase { |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
_circle(ctx, x, y, radius) { |
|
|
_circle(ctx, x, y, radius) { |
|
|
|
|
|
// draw shadow if enabled
|
|
|
|
|
|
this.enableShadow(ctx); |
|
|
|
|
|
|
|
|
// draw a circle
|
|
|
// draw a circle
|
|
|
ctx.beginPath(); |
|
|
ctx.beginPath(); |
|
|
ctx.arc(x, y, radius, 0, 2 * Math.PI, false); |
|
|
ctx.arc(x, y, radius, 0, 2 * Math.PI, false); |
|
|
ctx.stroke(); |
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
|
|
|
|
// disable shadows for other elements.
|
|
|
|
|
|
this.disableShadow(ctx); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -439,7 +451,13 @@ class EdgeBase { |
|
|
// draw arrow at the end of the line
|
|
|
// draw arrow at the end of the line
|
|
|
length = (10 + 5 * this.options.width) * scaleFactor; |
|
|
length = (10 + 5 * this.options.width) * scaleFactor; |
|
|
ctx.arrow(arrowPos.x, arrowPos.y, angle, length); |
|
|
ctx.arrow(arrowPos.x, arrowPos.y, angle, length); |
|
|
|
|
|
|
|
|
|
|
|
// draw shadow if enabled
|
|
|
|
|
|
this.enableShadow(ctx); |
|
|
ctx.fill(); |
|
|
ctx.fill(); |
|
|
|
|
|
|
|
|
|
|
|
// disable shadows for other elements.
|
|
|
|
|
|
this.disableShadow(ctx); |
|
|
ctx.stroke(); |
|
|
ctx.stroke(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -463,11 +481,35 @@ class EdgeBase { |
|
|
// draw the arrowhead
|
|
|
// draw the arrowhead
|
|
|
let length = (10 + 5 * this.options.width) * scaleFactor; |
|
|
let length = (10 + 5 * this.options.width) * scaleFactor; |
|
|
ctx.arrow(point.x, point.y, angle, length); |
|
|
ctx.arrow(point.x, point.y, angle, length); |
|
|
|
|
|
|
|
|
|
|
|
// draw shadow if enabled
|
|
|
|
|
|
this.enableShadow(ctx); |
|
|
ctx.fill(); |
|
|
ctx.fill(); |
|
|
|
|
|
|
|
|
|
|
|
// disable shadows for other elements.
|
|
|
|
|
|
this.disableShadow(ctx); |
|
|
ctx.stroke(); |
|
|
ctx.stroke(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enableShadow(ctx) { |
|
|
|
|
|
if (this.options.shadow.enabled === true) { |
|
|
|
|
|
ctx.shadowColor = 'rgba(0,0,0,0.5)'; |
|
|
|
|
|
ctx.shadowBlur = this.options.shadow.size; |
|
|
|
|
|
ctx.shadowOffsetX = this.options.shadow.x; |
|
|
|
|
|
ctx.shadowOffsetY = this.options.shadow.y; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
disableShadow(ctx) { |
|
|
|
|
|
if (this.options.shadow.enabled === true) { |
|
|
|
|
|
ctx.shadowColor = 'rgba(0,0,0,0)'; |
|
|
|
|
|
ctx.shadowBlur = 0; |
|
|
|
|
|
ctx.shadowOffsetX = 0; |
|
|
|
|
|
ctx.shadowOffsetY = 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export default EdgeBase; |
|
|
export default EdgeBase; |