(detail: GestureDetail)
| 286 | } |
| 287 | |
| 288 | private activate(detail: GestureDetail) { |
| 289 | const clicked = detail.event.target as HTMLIonSegmentButtonElement; |
| 290 | const buttons = this.getButtons(); |
| 291 | const checked = buttons.find((button) => button.value === this.value); |
| 292 | |
| 293 | // Make sure we are only checking for activation on a segment button |
| 294 | // since disabled buttons will get the click on the segment |
| 295 | if (clicked.tagName !== 'ION-SEGMENT-BUTTON') { |
| 296 | return; |
| 297 | } |
| 298 | |
| 299 | // If there are no checked buttons, set the current button to checked |
| 300 | if (!checked) { |
| 301 | this.value = clicked.value; |
| 302 | this.setCheckedClasses(); |
| 303 | } |
| 304 | |
| 305 | // If the gesture began on the clicked button with the indicator |
| 306 | // then we should activate the indicator |
| 307 | if (this.value === clicked.value) { |
| 308 | this.setActivated(true); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | private getIndicator(button: HTMLIonSegmentButtonElement): HTMLDivElement | null { |
| 313 | const root = button.shadowRoot || button; |
no test coverage detected