MCPcopy Create free account
hub / github.com/rough-stuff/wired-elements / ellipse

Method ellipse

packages/wired-lib/wired-lib.js:64–77  ·  view source on GitHub ↗
(svg, x, y, width, height)

Source from the content-addressed store, hash-verified

62 }
63
64 ellipse(svg, x, y, width, height) {
65 width = Math.max(width > 10 ? width - 4 : width - 1, 1);
66 height = Math.max(height > 10 ? height - 4 : height - 1, 1);
67 const ellipseInc = (Math.PI * 2) / __curveStepCount;
68 let rx = Math.abs(width / 2);
69 let ry = Math.abs(height / 2);
70 rx += this._getOffset(-rx * 0.05, rx * 0.05);
71 ry += this._getOffset(-ry * 0.05, ry * 0.05);
72 let path = this._ellipse(ellipseInc, x, y, rx, ry, 1, ellipseInc * this._getOffset(0.1, this._getOffset(0.4, 1)));
73 path = this._ellipse(ellipseInc, x, y, rx, ry, 1.5, 0, path);
74 const node = this._svgNode("path", { d: path.value })
75 svg.appendChild(node);
76 return node;
77 }
78
79 _ellipse(ellipseInc, cx, cy, rx, ry, offset, overlap, existingPath) {
80 const radOffset = this._getOffset(-0.5, 0.5) - Math.PI / 2;

Callers 4

_didRenderMethod · 0.80
_firstRenderedMethod · 0.80
_didRenderMethod · 0.80
_didRenderMethod · 0.80

Calls 3

_getOffsetMethod · 0.95
_ellipseMethod · 0.95
_svgNodeMethod · 0.95

Tested by

no test coverage detected