@egjs/flicking 4.11.3-beta.0 → 4.11.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.11.3-beta.0",
3
+ "version": "4.11.3-beta.2",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.cjs.js",
6
6
  "module": "dist/flicking.esm.js",
@@ -306,7 +306,7 @@ abstract class Control {
306
306
  axesEvent?: OnRelease;
307
307
  }) {
308
308
  const position = this._getPosition(panel, direction);
309
- this._triggerIndexChangeEvent(panel, panel.position, axesEvent);
309
+ this._triggerIndexChangeEvent(panel, panel.position, axesEvent, direction);
310
310
 
311
311
  return this._animateToPosition({ position, duration, newActivePanel: panel, axesEvent });
312
312
  }
@@ -347,7 +347,7 @@ abstract class Control {
347
347
  this._controller = control._controller;
348
348
  }
349
349
 
350
- protected _triggerIndexChangeEvent(panel: Panel, position: number, axesEvent?: OnRelease) {
350
+ protected _triggerIndexChangeEvent(panel: Panel, position: number, axesEvent?: OnRelease, direction?: ValueOf<typeof DIRECTION>) {
351
351
  const flicking = getFlickingAttached(this._flicking);
352
352
  const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE;
353
353
  const camera = flicking.camera;
@@ -357,7 +357,7 @@ abstract class Control {
357
357
  index: panel.index,
358
358
  panel,
359
359
  isTrusted: axesEvent?.isTrusted || false,
360
- direction: getDirection(activePanel?.position ?? camera.position, position)
360
+ direction: direction ?? getDirection(activePanel?.position ?? camera.position, position)
361
361
  });
362
362
 
363
363
  this._nextPanel = panel;
@@ -95,7 +95,7 @@ class SnapControl extends Control {
95
95
  return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE));
96
96
  }
97
97
 
98
- const snapThreshold = this._calcSnapThreshold(flicking.threshold, position, activeAnchor);
98
+ const snapThreshold = this._calcSnapThreshold(position, activeAnchor);
99
99
 
100
100
  const posDelta = flicking.animating
101
101
  ? state.delta
@@ -210,7 +210,7 @@ class SnapControl extends Control {
210
210
  return adjacentAnchor;
211
211
  }
212
212
 
213
- private _calcSnapThreshold(threshold: number, position: number, activeAnchor: AnchorPoint): number {
213
+ private _calcSnapThreshold(position: number, activeAnchor: AnchorPoint): number {
214
214
  const isNextDirection = position > activeAnchor.position;
215
215
  const panel = activeAnchor.panel;
216
216
  const panelSize = panel.size;
@@ -222,9 +222,9 @@ class SnapControl extends Control {
222
222
  * |<------>|<------------>|
223
223
  * [ |<-Anchor ]
224
224
  */
225
- return Math.max(threshold, isNextDirection
225
+ return isNextDirection
226
226
  ? panelSize - alignPos + panel.margin.next
227
- : alignPos + panel.margin.prev);
227
+ : alignPos + panel.margin.prev;
228
228
  }
229
229
  }
230
230