Skip to content

Commit 994b969

Browse files
Second checkpoint
1 parent 6017570 commit 994b969

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

core/src/components/item-sliding/item-sliding.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export class ItemSliding implements ComponentInterface {
295295
*/
296296
private getSwipeThreshold(): number {
297297
const maxWidth = Math.max(this.optsWidthRightSide, this.optsWidthLeftSide);
298-
return maxWidth + 2000; // Slightly larger than SWIPE_MARGIN to be achievable
298+
return maxWidth + 100; // Slightly larger than SWIPE_MARGIN to be achievable
299299
}
300300

301301
/**
@@ -304,7 +304,6 @@ export class ItemSliding implements ComponentInterface {
304304
*/
305305
private async animateFullSwipe(direction: 'start' | 'end') {
306306
// Prevent interruption during animation
307-
this.state = SlidingState.AnimatingFullSwipe;
308307
if (this.gesture) {
309308
this.gesture.enable(false);
310309
}
@@ -317,12 +316,17 @@ export class ItemSliding implements ComponentInterface {
317316
const options = direction === 'end' ? this.rightOptions : this.leftOptions;
318317
const optsWidth = direction === 'end' ? this.optsWidthRightSide : this.optsWidthLeftSide;
319318

320-
// Phase 1: First reveal the options fully (so expandable option fills space)
321-
const initialOpenAmount = direction === 'end' ? optsWidth : -optsWidth;
322-
this.setOpenAmount(initialOpenAmount, false);
323-
await new Promise((resolve) => setTimeout(resolve, 50));
319+
// Phase 1: Reveal options beyond threshold to trigger expandable state
320+
// This sets the SwipeEnd or SwipeStart state which expands the expandable option
321+
const thresholdAmount = direction === 'end' ? optsWidth + SWIPE_MARGIN : -(optsWidth + SWIPE_MARGIN);
322+
this.setOpenAmount(thresholdAmount, false);
324323

325-
// Phase 2: Animate off-screen from current position
324+
// Add AnimatingFullSwipe flag while preserving the SwipeEnd/SwipeStart state
325+
this.state = this.state | SlidingState.AnimatingFullSwipe;
326+
327+
await new Promise((resolve) => setTimeout(resolve, 100));
328+
329+
// Phase 2: Animate off-screen while maintaining the expanded state
326330
const offScreenDistance = direction === 'end' ? window.innerWidth : -window.innerWidth;
327331
await this.animateToPosition(offScreenDistance, 250);
328332

@@ -332,7 +336,7 @@ export class ItemSliding implements ComponentInterface {
332336
}
333337

334338
// Phase 4: Small delay before returning
335-
await new Promise((resolve) => setTimeout(resolve, 500));
339+
await new Promise((resolve) => setTimeout(resolve, 300));
336340

337341
// Phase 5: Return to closed state
338342
await this.animateToPosition(0, 250);

0 commit comments

Comments
 (0)