mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
style: lint
This commit is contained in:
@ -166,10 +166,7 @@ export class SegmentButton implements ComponentInterface, ButtonInterface {
|
|||||||
</span>
|
</span>
|
||||||
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
|
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div part="indicator" class="segment-button-indicator segment-button-indicator-animated">
|
||||||
part="indicator"
|
|
||||||
class="segment-button-indicator segment-button-indicator-animated"
|
|
||||||
>
|
|
||||||
<div part="indicator-background" class="segment-button-indicator-background"></div>
|
<div part="indicator-background" class="segment-button-indicator-background"></div>
|
||||||
</div>
|
</div>
|
||||||
</Host>
|
</Host>
|
||||||
|
@ -39,7 +39,7 @@ export class SegmentView implements ComponentInterface {
|
|||||||
// Emit the scroll direction and distance
|
// Emit the scroll direction and distance
|
||||||
this.ionSegmentViewScroll.emit({
|
this.ionSegmentViewScroll.emit({
|
||||||
scrollDirection,
|
scrollDirection,
|
||||||
scrollDistance
|
scrollDistance,
|
||||||
});
|
});
|
||||||
|
|
||||||
const atSnappingPoint = scrollLeft % offsetWidth === 0;
|
const atSnappingPoint = scrollLeft % offsetWidth === 0;
|
||||||
|
@ -65,7 +65,9 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|||||||
await expect(segmentContent).toBeInViewport();
|
await expect(segmentContent).toBeInViewport();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should scroll to the third content and update the segment value when the second segment content is disabled', async ({ page }) => {
|
test('should scroll to the third content and update the segment value when the second segment content is disabled', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
await page.setContent(
|
await page.setContent(
|
||||||
`
|
`
|
||||||
<ion-segment>
|
<ion-segment>
|
||||||
|
@ -374,8 +374,7 @@ export class Segment implements ComponentInterface {
|
|||||||
|
|
||||||
// Calculate the max and min allowed transformations based on the scroll direction
|
// Calculate the max and min allowed transformations based on the scroll direction
|
||||||
const maxTransform = scrollDirection === 'left' ? 0 : segmentRect.width - buttonRect.width;
|
const maxTransform = scrollDirection === 'left' ? 0 : segmentRect.width - buttonRect.width;
|
||||||
const minTransform = scrollDirection === 'left' ?
|
const minTransform = scrollDirection === 'left' ? -(segmentRect.width - buttonRect.width) : 0;
|
||||||
-(segmentRect.width - buttonRect.width) : 0;
|
|
||||||
|
|
||||||
// Clamp the transform value to ensure it doesn't go out of bounds
|
// Clamp the transform value to ensure it doesn't go out of bounds
|
||||||
const clampedTransform = Math.max(minTransform, Math.min(transformValue, maxTransform));
|
const clampedTransform = Math.max(minTransform, Math.min(transformValue, maxTransform));
|
||||||
|
Reference in New Issue
Block a user