Browse Source

Avoid overriding standard context method ellipse() (#3072)

gemini
wimrijnders 7 years ago
committed by yotamberk
parent
commit
bf80a902f2
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      lib/network/modules/components/nodes/shapes/Ellipse.js
  2. +3
    -1
      lib/network/shapes.js

+ 1
- 1
lib/network/modules/components/nodes/shapes/Ellipse.js View File

@ -28,7 +28,7 @@ class Ellipse extends NodeBase {
ctx.strokeStyle = values.borderColor;
ctx.fillStyle = values.color;
ctx.ellipse(this.left, this.top, this.width, this.height);
ctx.ellipse_vis(this.left, this.top, this.width, this.height);
// draw shadow if enabled
this.enableShadow(ctx, values);

+ 3
- 1
lib/network/shapes.js View File

@ -149,8 +149,10 @@ if (typeof CanvasRenderingContext2D !== 'undefined') {
/**
* http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
*
* Postfix '_vis' added to discern it from standard method ellipse().
*/
CanvasRenderingContext2D.prototype.ellipse = function (x, y, w, h) {
CanvasRenderingContext2D.prototype.ellipse_vis = function (x, y, w, h) {
var kappa = .5522848,
ox = (w / 2) * kappa, // control point offset horizontal
oy = (h / 2) * kappa, // control point offset vertical

Loading…
Cancel
Save