@egjs/flicking 4.12.1-beta.3 → 4.12.1-beta.4

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.
@@ -4,7 +4,7 @@ name: @egjs/flicking
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking
7
- version: 4.12.2-beta.0
7
+ version: 4.12.1-beta.4
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1404,25 +1404,10 @@ version: 4.12.2-beta.0
1404
1404
  var AutoResizer = /*#__PURE__*/function () {
1405
1405
  function AutoResizer(flicking) {
1406
1406
  var _this = this;
1407
- this._onResize = function (entries) {
1407
+ this._onResize = function () {
1408
1408
  var flicking = _this._flicking;
1409
1409
  var resizeDebounce = flicking.resizeDebounce;
1410
1410
  var maxResizeDebounce = flicking.maxResizeDebounce;
1411
- if (entries.length) {
1412
- var resizeEntryInfo = entries[0].contentRect;
1413
- var beforeSize = {
1414
- width: flicking.viewport.width,
1415
- height: flicking.viewport.height
1416
- };
1417
- var afterSize = {
1418
- width: resizeEntryInfo.width,
1419
- height: resizeEntryInfo.height
1420
- };
1421
- // resize 이벤트가 발생했으나 이전과 width, height의 변화가 없다면 이후 로직을 진행하지 않는다.
1422
- if (beforeSize.height === afterSize.height && beforeSize.width === afterSize.width) {
1423
- return;
1424
- }
1425
- }
1426
1411
  if (resizeDebounce <= 0) {
1427
1412
  void flicking.resize();
1428
1413
  } else {
@@ -1448,12 +1433,12 @@ version: 4.12.2-beta.0
1448
1433
  // eslint-disable-next-line @typescript-eslint/member-ordering
1449
1434
  this._skipFirstResize = function () {
1450
1435
  var isFirstResize = true;
1451
- return function (entries) {
1436
+ return function () {
1452
1437
  if (isFirstResize) {
1453
1438
  isFirstResize = false;
1454
1439
  return;
1455
1440
  }
1456
- _this._onResize(entries);
1441
+ _this._onResize();
1457
1442
  };
1458
1443
  }();
1459
1444
  this._flicking = flicking;
@@ -1471,7 +1456,6 @@ version: 4.12.2-beta.0
1471
1456
  configurable: true
1472
1457
  });
1473
1458
  __proto.enable = function () {
1474
- var _this = this;
1475
1459
  var flicking = this._flicking;
1476
1460
  var viewport = flicking.viewport;
1477
1461
  if (this._enabled) {
@@ -1479,32 +1463,23 @@ version: 4.12.2-beta.0
1479
1463
  }
1480
1464
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
1481
1465
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
1482
- var resizeObserver = viewportSizeNot0 ? new ResizeObserver(function (entries) {
1483
- return _this._skipFirstResize(entries);
1484
- }) : new ResizeObserver(function (entries) {
1485
- return _this._onResize(entries);
1486
- });
1466
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1487
1467
  resizeObserver.observe(flicking.viewport.element);
1488
1468
  this._resizeObserver = resizeObserver;
1489
1469
  } else {
1490
- window.addEventListener("resize", function () {
1491
- return _this._onResize([]);
1492
- });
1470
+ window.addEventListener("resize", this._onResize);
1493
1471
  }
1494
1472
  this._enabled = true;
1495
1473
  return this;
1496
1474
  };
1497
1475
  __proto.disable = function () {
1498
- var _this = this;
1499
1476
  if (!this._enabled) return this;
1500
1477
  var resizeObserver = this._resizeObserver;
1501
1478
  if (resizeObserver) {
1502
1479
  resizeObserver.disconnect();
1503
1480
  this._resizeObserver = null;
1504
1481
  } else {
1505
- window.removeEventListener("resize", function () {
1506
- return _this._onResize([]);
1507
- });
1482
+ window.removeEventListener("resize", this._onResize);
1508
1483
  }
1509
1484
  this._enabled = false;
1510
1485
  return this;
@@ -2723,7 +2698,7 @@ version: 4.12.2-beta.0
2723
2698
  license: MIT
2724
2699
  author: NAVER Corp.
2725
2700
  repository: https://github.com/naver/egjs-axes
2726
- version: 3.9.1
2701
+ version: 3.9.2
2727
2702
  */
2728
2703
 
2729
2704
  /*! *****************************************************************************
@@ -3649,6 +3624,19 @@ version: 4.12.2-beta.0
3649
3624
  var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;
3650
3625
  var velocityX = prevEvent ? prevEvent.velocityX : 0;
3651
3626
  var velocityY = prevEvent ? prevEvent.velocityY : 0;
3627
+ var directionX = prevEvent ? prevEvent.directionX : 1;
3628
+ var directionY = prevEvent ? prevEvent.directionY : 1;
3629
+ // If offset is 0, it inherits the direction of the previous event.
3630
+ if (offsetX > 0) {
3631
+ directionX = 1;
3632
+ } else if (offsetX < 0) {
3633
+ directionX = -1;
3634
+ }
3635
+ if (offsetY > 0) {
3636
+ directionY = 1;
3637
+ } else if (offsetY < 0) {
3638
+ directionY = -1;
3639
+ }
3652
3640
  if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {
3653
3641
  if (latestInterval) {
3654
3642
  _a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1];
@@ -3668,6 +3656,8 @@ version: 4.12.2-beta.0
3668
3656
  deltaY: deltaY,
3669
3657
  offsetX: offsetX,
3670
3658
  offsetY: offsetY,
3659
+ directionX: directionX,
3660
+ directionY: directionY,
3671
3661
  velocityX: velocityX,
3672
3662
  velocityY: velocityY,
3673
3663
  preventSystemEvent: true
@@ -5131,7 +5121,7 @@ version: 4.12.2-beta.0
5131
5121
  * eg.Axes.VERSION; // ex) 3.3.3
5132
5122
  * ```
5133
5123
  */
5134
- Axes.VERSION = "3.9.1";
5124
+ Axes.VERSION = "3.9.2";
5135
5125
  /* eslint-enable */
5136
5126
  /**
5137
5127
  * @name TRANSFORM
@@ -5482,7 +5472,7 @@ version: 4.12.2-beta.0
5482
5472
  this._detachWindowEvent(activeEvent);
5483
5473
  clearTimeout(this._rightEdgeTimer);
5484
5474
  var prevEvent = activeEvent.prevEvent;
5485
- var velocity = this._isOverThreshold ? this._getOffset([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]) : [0, 0];
5475
+ var velocity = this._isOverThreshold ? this._getOffset([Math.abs(prevEvent.velocityX) * prevEvent.directionX, Math.abs(prevEvent.velocityY) * prevEvent.directionY], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]) : [0, 0];
5486
5476
  activeEvent.onRelease();
5487
5477
  this._observer.release(this, prevEvent, velocity);
5488
5478
  };
@@ -7153,7 +7143,7 @@ version: 4.12.2-beta.0
7153
7143
  if (snapDelta >= snapThreshold && snapDelta > 0) {
7154
7144
  // Move to anchor at position
7155
7145
  targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
7156
- } else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
7146
+ } else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
7157
7147
  // Move to the adjacent panel
7158
7148
  targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
7159
7149
  } else {
@@ -7163,11 +7153,14 @@ version: 4.12.2-beta.0
7163
7153
  axesEvent: axesEvent
7164
7154
  });
7165
7155
  }
7166
- this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
7156
+ var nextPanel = targetAnchor.panel;
7157
+ var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
7158
+ var nextPosition = this._getPosition(nextPanel, direction);
7159
+ this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
7167
7160
  return this._animateToPosition({
7168
- position: camera.clampToReachablePosition(targetAnchor.position),
7161
+ position: camera.clampToReachablePosition(nextPosition),
7169
7162
  duration: duration,
7170
- newActivePanel: targetAnchor.panel,
7163
+ newActivePanel: nextPanel,
7171
7164
  axesEvent: axesEvent
7172
7165
  });
7173
7166
  };
@@ -7177,12 +7170,13 @@ version: 4.12.2-beta.0
7177
7170
  var count = this._count;
7178
7171
  var currentPos = camera.position;
7179
7172
  var clampedPosition = camera.clampToReachablePosition(position);
7173
+ var nearestAnchor = camera.findNearestAnchor(clampedPosition);
7180
7174
  var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
7181
- if (!anchorAtCamera || !anchorAtPosition) {
7175
+ if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
7182
7176
  throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
7183
7177
  }
7184
7178
  if (!isFinite(count)) {
7185
- return anchorAtPosition;
7179
+ return nearestAnchor;
7186
7180
  }
7187
7181
  var panelCount = flicking.panelCount;
7188
7182
  var anchors = camera.anchorPoints;
@@ -11267,7 +11261,6 @@ version: 4.12.2-beta.0
11267
11261
  // Internal states
11268
11262
  _this._initialized = false;
11269
11263
  _this._plugins = [];
11270
- _this._isResizing = false;
11271
11264
  // Bind options
11272
11265
  _this._align = align;
11273
11266
  _this._defaultIndex = defaultIndex;
@@ -12807,8 +12800,6 @@ version: 4.12.2-beta.0
12807
12800
  return __generator(this, function (_a) {
12808
12801
  switch (_a.label) {
12809
12802
  case 0:
12810
- if (this._isResizing) return [2 /*return*/];
12811
- this._isResizing = true;
12812
12803
  viewport = this._viewport;
12813
12804
  renderer = this._renderer;
12814
12805
  camera = this._camera;
@@ -12861,7 +12852,6 @@ version: 4.12.2-beta.0
12861
12852
  sizeChanged: sizeChanged,
12862
12853
  element: viewport.element
12863
12854
  }));
12864
- this._isResizing = false;
12865
12855
  return [2 /*return*/];
12866
12856
  }
12867
12857
  });
@@ -12989,7 +12979,7 @@ version: 4.12.2-beta.0
12989
12979
  __proto._createCamera = function () {
12990
12980
  if (this._circular && this._bound) {
12991
12981
  // eslint-disable-next-line no-console
12992
- console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
12982
+ console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
12993
12983
  }
12994
12984
  return new Camera$1(this, {
12995
12985
  align: this._align
@@ -12999,7 +12989,7 @@ version: 4.12.2-beta.0
12999
12989
  var externalRenderer = this._externalRenderer;
13000
12990
  if (this._virtual && this._panelsPerView <= 0) {
13001
12991
  // eslint-disable-next-line no-console
13002
- console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
12992
+ console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
13003
12993
  }
13004
12994
  return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
13005
12995
  };
@@ -13081,7 +13071,7 @@ version: 4.12.2-beta.0
13081
13071
  * Flicking.VERSION; // ex) 4.0.0
13082
13072
  * ```
13083
13073
  */
13084
- Flicking.VERSION = "4.12.2-beta.0";
13074
+ Flicking.VERSION = "4.12.1-beta.4";
13085
13075
  return Flicking;
13086
13076
  }(Component);
13087
13077