mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
Merge remote-tracking branch 'origin/main' into sp/sync-feature-7.1-with-main
This commit is contained in:
@ -5,7 +5,6 @@ import { pointerCoord } from '@utils/helpers';
|
||||
import { isRTL } from '@utils/rtl';
|
||||
import { createColorClasses, hostContext } from '@utils/theme';
|
||||
|
||||
import { config } from '../../global/config';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import type { Color, StyleEventDetail } from '../../interface';
|
||||
|
||||
@ -194,14 +193,10 @@ export class Segment implements ComponentInterface {
|
||||
onEnd(detail: GestureDetail) {
|
||||
this.setActivated(false);
|
||||
|
||||
const checkedValidButton = this.setNextIndex(detail, true);
|
||||
this.setNextIndex(detail, true);
|
||||
|
||||
detail.event.stopImmediatePropagation();
|
||||
|
||||
if (checkedValidButton) {
|
||||
this.addRipple(detail);
|
||||
}
|
||||
|
||||
const value = this.value;
|
||||
if (value !== undefined) {
|
||||
if (this.valueBeforeGesture !== value) {
|
||||
@ -230,32 +225,6 @@ export class Segment implements ComponentInterface {
|
||||
return this.getButtons().find((button) => button.value === this.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The gesture blocks the segment button ripple. This
|
||||
* function adds the ripple based on the checked segment
|
||||
* and where the cursor ended.
|
||||
*/
|
||||
private addRipple(detail: GestureDetail) {
|
||||
const useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true);
|
||||
if (!useRippleEffect) {
|
||||
return;
|
||||
}
|
||||
|
||||
const buttons = this.getButtons();
|
||||
const checked = buttons.find((button) => button.value === this.value)!;
|
||||
|
||||
const root = checked.shadowRoot || checked;
|
||||
const ripple = root.querySelector('ion-ripple-effect');
|
||||
|
||||
if (!ripple) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { x, y } = pointerCoord(detail.event);
|
||||
|
||||
ripple.addRipple(x, y).then((remove) => remove());
|
||||
}
|
||||
|
||||
/*
|
||||
* Activate both the segment and the buttons
|
||||
* due to a bug with ::slotted in Safari
|
||||
|
Reference in New Issue
Block a user