@egjs/flicking 4.11.3-beta.1 → 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.1",
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",
@@ -404,11 +404,9 @@ class Camera {
404
404
  */
405
405
  public findActiveAnchor(): AnchorPoint | null {
406
406
  const flicking = getFlickingAttached(this._flicking);
407
- const activePanel = flicking.control.activePanel;
408
-
409
- if (!activePanel) return null;
407
+ const activeIndex = flicking.control.activeIndex;
410
408
 
411
- return find(this._anchors, anchor => anchor.panel.index === activePanel.index) ?? this.findNearestAnchor(activePanel.position);
409
+ return find(this._anchors, anchor => anchor.panel.index === activeIndex);
412
410
  }
413
411
 
414
412
  /**
@@ -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;