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