()
| 100 | } |
| 101 | |
| 102 | _didRender() { |
| 103 | const svg = this.shadowRoot.getElementById('svg'); |
| 104 | this._clearNode(svg); |
| 105 | const s = { width: (this.height || 32) * 2.5, height: this.height || 32 }; |
| 106 | svg.setAttribute("width", s.width); |
| 107 | svg.setAttribute("height", s.height); |
| 108 | wired.rectangle(svg, 0, 0, s.width, s.height); |
| 109 | this.knob = wired.ellipse(svg, s.height / 2, s.height / 2, s.height, s.height); |
| 110 | this.knobOffset = s.width - s.height; |
| 111 | this.knob.style.transition = "all 0.3s ease"; |
| 112 | this.knob.style.transform = this.checked ? ("translateX(" + this.knobOffset + "px)") : ""; |
| 113 | const cl = this.knob.classList; |
| 114 | if (this.checked) { |
| 115 | cl.remove("unchecked"); |
| 116 | cl.add("checked"); |
| 117 | } else { |
| 118 | cl.remove("checked"); |
| 119 | cl.add("unchecked"); |
| 120 | } |
| 121 | this.classList.remove('pending'); |
| 122 | this._setAria(); |
| 123 | this._attachEvents(); |
| 124 | } |
| 125 | |
| 126 | _attachEvents() { |
| 127 | if (!this._keyboardAttached) { |
nothing calls this directly
no test coverage detected