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

Method _didRender

packages/wired-button/wired-button.js:115–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113 }
114
115 _didRender() {
116 const svg = this.shadowRoot.getElementById('svg');
117 this._clearNode(svg);
118 const s = this.getBoundingClientRect();
119 const elev = Math.min(Math.max(1, this.elevation), 5);
120 const w = s.width + ((elev - 1) * 2);
121 const h = s.height + ((elev - 1) * 2);
122 svg.setAttribute("width", w);
123 svg.setAttribute("height", h);
124 wired.rectangle(svg, 0, 0, s.width, s.height);
125 for (var i = 1; i < elev; i++) {
126 (wired.line(svg, (i * 2), s.height + (i * 2), s.width + (i * 2), s.height + (i * 2))).style.opacity = (75 - (i * 10)) / 100;
127 (wired.line(svg, s.width + (i * 2), s.height + (i * 2), s.width + (i * 2), i * 2)).style.opacity = (75 - (i * 10)) / 100;
128 (wired.line(svg, (i * 2), s.height + (i * 2), s.width + (i * 2), s.height + (i * 2))).style.opacity = (75 - (i * 10)) / 100;
129 (wired.line(svg, s.width + (i * 2), s.height + (i * 2), s.width + (i * 2), i * 2)).style.opacity = (75 - (i * 10)) / 100;
130 }
131 this.classList.remove('pending');
132 }
133}
134
135customElements.define('wired-button', WiredButton);

Callers 1

connectedCallbackMethod · 0.95

Calls 3

_clearNodeMethod · 0.95
rectangleMethod · 0.80
lineMethod · 0.80

Tested by

no test coverage detected