@egjs/flicking 4.12.1-beta.2 → 4.12.1-beta.3
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/debug/example/index.html +82 -0
- package/declaration/Flicking.d.ts +3 -2
- package/dist/flicking.cjs.js +40 -13
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +40 -13
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +40 -13
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +43 -31
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/Flicking.ts +449 -200
- package/src/control/SnapControl.ts +1 -3
- package/src/core/AutoResizer.ts +40 -11
package/dist/flicking.pkgd.js
CHANGED
|
@@ -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.
|
|
7
|
+
version: 4.12.2-beta.0
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -1404,10 +1404,25 @@ version: 4.12.1-beta.2
|
|
|
1404
1404
|
var AutoResizer = /*#__PURE__*/function () {
|
|
1405
1405
|
function AutoResizer(flicking) {
|
|
1406
1406
|
var _this = this;
|
|
1407
|
-
this._onResize = function () {
|
|
1407
|
+
this._onResize = function (entries) {
|
|
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
|
+
}
|
|
1411
1426
|
if (resizeDebounce <= 0) {
|
|
1412
1427
|
void flicking.resize();
|
|
1413
1428
|
} else {
|
|
@@ -1433,12 +1448,12 @@ version: 4.12.1-beta.2
|
|
|
1433
1448
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1434
1449
|
this._skipFirstResize = function () {
|
|
1435
1450
|
var isFirstResize = true;
|
|
1436
|
-
return function () {
|
|
1451
|
+
return function (entries) {
|
|
1437
1452
|
if (isFirstResize) {
|
|
1438
1453
|
isFirstResize = false;
|
|
1439
1454
|
return;
|
|
1440
1455
|
}
|
|
1441
|
-
_this._onResize();
|
|
1456
|
+
_this._onResize(entries);
|
|
1442
1457
|
};
|
|
1443
1458
|
}();
|
|
1444
1459
|
this._flicking = flicking;
|
|
@@ -1456,6 +1471,7 @@ version: 4.12.1-beta.2
|
|
|
1456
1471
|
configurable: true
|
|
1457
1472
|
});
|
|
1458
1473
|
__proto.enable = function () {
|
|
1474
|
+
var _this = this;
|
|
1459
1475
|
var flicking = this._flicking;
|
|
1460
1476
|
var viewport = flicking.viewport;
|
|
1461
1477
|
if (this._enabled) {
|
|
@@ -1463,23 +1479,32 @@ version: 4.12.1-beta.2
|
|
|
1463
1479
|
}
|
|
1464
1480
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1465
1481
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1466
|
-
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(
|
|
1482
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(function (entries) {
|
|
1483
|
+
return _this._skipFirstResize(entries);
|
|
1484
|
+
}) : new ResizeObserver(function (entries) {
|
|
1485
|
+
return _this._onResize(entries);
|
|
1486
|
+
});
|
|
1467
1487
|
resizeObserver.observe(flicking.viewport.element);
|
|
1468
1488
|
this._resizeObserver = resizeObserver;
|
|
1469
1489
|
} else {
|
|
1470
|
-
window.addEventListener("resize",
|
|
1490
|
+
window.addEventListener("resize", function () {
|
|
1491
|
+
return _this._onResize([]);
|
|
1492
|
+
});
|
|
1471
1493
|
}
|
|
1472
1494
|
this._enabled = true;
|
|
1473
1495
|
return this;
|
|
1474
1496
|
};
|
|
1475
1497
|
__proto.disable = function () {
|
|
1498
|
+
var _this = this;
|
|
1476
1499
|
if (!this._enabled) return this;
|
|
1477
1500
|
var resizeObserver = this._resizeObserver;
|
|
1478
1501
|
if (resizeObserver) {
|
|
1479
1502
|
resizeObserver.disconnect();
|
|
1480
1503
|
this._resizeObserver = null;
|
|
1481
1504
|
} else {
|
|
1482
|
-
window.removeEventListener("resize",
|
|
1505
|
+
window.removeEventListener("resize", function () {
|
|
1506
|
+
return _this._onResize([]);
|
|
1507
|
+
});
|
|
1483
1508
|
}
|
|
1484
1509
|
this._enabled = false;
|
|
1485
1510
|
return this;
|
|
@@ -2698,7 +2723,7 @@ version: 4.12.1-beta.2
|
|
|
2698
2723
|
license: MIT
|
|
2699
2724
|
author: NAVER Corp.
|
|
2700
2725
|
repository: https://github.com/naver/egjs-axes
|
|
2701
|
-
version: 3.9.
|
|
2726
|
+
version: 3.9.1
|
|
2702
2727
|
*/
|
|
2703
2728
|
|
|
2704
2729
|
/*! *****************************************************************************
|
|
@@ -3624,19 +3649,6 @@ version: 4.12.1-beta.2
|
|
|
3624
3649
|
var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;
|
|
3625
3650
|
var velocityX = prevEvent ? prevEvent.velocityX : 0;
|
|
3626
3651
|
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
|
-
}
|
|
3640
3652
|
if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {
|
|
3641
3653
|
if (latestInterval) {
|
|
3642
3654
|
_a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1];
|
|
@@ -3656,8 +3668,6 @@ version: 4.12.1-beta.2
|
|
|
3656
3668
|
deltaY: deltaY,
|
|
3657
3669
|
offsetX: offsetX,
|
|
3658
3670
|
offsetY: offsetY,
|
|
3659
|
-
directionX: directionX,
|
|
3660
|
-
directionY: directionY,
|
|
3661
3671
|
velocityX: velocityX,
|
|
3662
3672
|
velocityY: velocityY,
|
|
3663
3673
|
preventSystemEvent: true
|
|
@@ -5121,7 +5131,7 @@ version: 4.12.1-beta.2
|
|
|
5121
5131
|
* eg.Axes.VERSION; // ex) 3.3.3
|
|
5122
5132
|
* ```
|
|
5123
5133
|
*/
|
|
5124
|
-
Axes.VERSION = "3.9.
|
|
5134
|
+
Axes.VERSION = "3.9.1";
|
|
5125
5135
|
/* eslint-enable */
|
|
5126
5136
|
/**
|
|
5127
5137
|
* @name TRANSFORM
|
|
@@ -5472,7 +5482,7 @@ version: 4.12.1-beta.2
|
|
|
5472
5482
|
this._detachWindowEvent(activeEvent);
|
|
5473
5483
|
clearTimeout(this._rightEdgeTimer);
|
|
5474
5484
|
var prevEvent = activeEvent.prevEvent;
|
|
5475
|
-
var velocity = this._isOverThreshold ? this._getOffset([Math.abs(prevEvent.velocityX) * 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];
|
|
5476
5486
|
activeEvent.onRelease();
|
|
5477
5487
|
this._observer.release(this, prevEvent, velocity);
|
|
5478
5488
|
};
|
|
@@ -7143,9 +7153,8 @@ version: 4.12.1-beta.2
|
|
|
7143
7153
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
7144
7154
|
// Move to anchor at position
|
|
7145
7155
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
7146
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0
|
|
7156
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
7147
7157
|
// Move to the adjacent panel
|
|
7148
|
-
// console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
|
|
7149
7158
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
7150
7159
|
} else {
|
|
7151
7160
|
// Fallback to nearest panel from current camera
|
|
@@ -7220,7 +7229,6 @@ version: 4.12.1-beta.2
|
|
|
7220
7229
|
return anchorIncludePosition;
|
|
7221
7230
|
}
|
|
7222
7231
|
}
|
|
7223
|
-
// console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
|
|
7224
7232
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
7225
7233
|
return adjacentAnchor;
|
|
7226
7234
|
};
|
|
@@ -11259,6 +11267,7 @@ version: 4.12.1-beta.2
|
|
|
11259
11267
|
// Internal states
|
|
11260
11268
|
_this._initialized = false;
|
|
11261
11269
|
_this._plugins = [];
|
|
11270
|
+
_this._isResizing = false;
|
|
11262
11271
|
// Bind options
|
|
11263
11272
|
_this._align = align;
|
|
11264
11273
|
_this._defaultIndex = defaultIndex;
|
|
@@ -12798,6 +12807,8 @@ version: 4.12.1-beta.2
|
|
|
12798
12807
|
return __generator(this, function (_a) {
|
|
12799
12808
|
switch (_a.label) {
|
|
12800
12809
|
case 0:
|
|
12810
|
+
if (this._isResizing) return [2 /*return*/];
|
|
12811
|
+
this._isResizing = true;
|
|
12801
12812
|
viewport = this._viewport;
|
|
12802
12813
|
renderer = this._renderer;
|
|
12803
12814
|
camera = this._camera;
|
|
@@ -12850,6 +12861,7 @@ version: 4.12.1-beta.2
|
|
|
12850
12861
|
sizeChanged: sizeChanged,
|
|
12851
12862
|
element: viewport.element
|
|
12852
12863
|
}));
|
|
12864
|
+
this._isResizing = false;
|
|
12853
12865
|
return [2 /*return*/];
|
|
12854
12866
|
}
|
|
12855
12867
|
});
|
|
@@ -12977,7 +12989,7 @@ version: 4.12.1-beta.2
|
|
|
12977
12989
|
__proto._createCamera = function () {
|
|
12978
12990
|
if (this._circular && this._bound) {
|
|
12979
12991
|
// eslint-disable-next-line no-console
|
|
12980
|
-
console.warn("
|
|
12992
|
+
console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
|
|
12981
12993
|
}
|
|
12982
12994
|
return new Camera$1(this, {
|
|
12983
12995
|
align: this._align
|
|
@@ -12987,7 +12999,7 @@ version: 4.12.1-beta.2
|
|
|
12987
12999
|
var externalRenderer = this._externalRenderer;
|
|
12988
13000
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
12989
13001
|
// eslint-disable-next-line no-console
|
|
12990
|
-
console.warn("
|
|
13002
|
+
console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
|
|
12991
13003
|
}
|
|
12992
13004
|
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
12993
13005
|
};
|
|
@@ -13069,7 +13081,7 @@ version: 4.12.1-beta.2
|
|
|
13069
13081
|
* Flicking.VERSION; // ex) 4.0.0
|
|
13070
13082
|
* ```
|
|
13071
13083
|
*/
|
|
13072
|
-
Flicking.VERSION = "4.12.
|
|
13084
|
+
Flicking.VERSION = "4.12.2-beta.0";
|
|
13073
13085
|
return Flicking;
|
|
13074
13086
|
}(Component);
|
|
13075
13087
|
|