@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.
- package/declaration/Flicking.d.ts +2 -3
- package/declaration/control/Control.d.ts +1 -1
- package/dist/flicking.cjs.js +20 -45
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +20 -45
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +20 -45
- 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 +38 -48
- 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 +200 -449
- package/src/control/Control.ts +1 -1
- package/src/control/SnapControl.ts +12 -6
- package/src/core/AutoResizer.ts +11 -40
- package/debug/example/index.html +0 -82
package/dist/flicking.esm.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.1-beta.4
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -947,25 +947,10 @@ var Viewport = /*#__PURE__*/function () {
|
|
|
947
947
|
var AutoResizer = /*#__PURE__*/function () {
|
|
948
948
|
function AutoResizer(flicking) {
|
|
949
949
|
var _this = this;
|
|
950
|
-
this._onResize = function (
|
|
950
|
+
this._onResize = function () {
|
|
951
951
|
var flicking = _this._flicking;
|
|
952
952
|
var resizeDebounce = flicking.resizeDebounce;
|
|
953
953
|
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
954
|
-
if (entries.length) {
|
|
955
|
-
var resizeEntryInfo = entries[0].contentRect;
|
|
956
|
-
var beforeSize = {
|
|
957
|
-
width: flicking.viewport.width,
|
|
958
|
-
height: flicking.viewport.height
|
|
959
|
-
};
|
|
960
|
-
var afterSize = {
|
|
961
|
-
width: resizeEntryInfo.width,
|
|
962
|
-
height: resizeEntryInfo.height
|
|
963
|
-
};
|
|
964
|
-
// resize 이벤트가 발생했으나 이전과 width, height의 변화가 없다면 이후 로직을 진행하지 않는다.
|
|
965
|
-
if (beforeSize.height === afterSize.height && beforeSize.width === afterSize.width) {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
954
|
if (resizeDebounce <= 0) {
|
|
970
955
|
void flicking.resize();
|
|
971
956
|
} else {
|
|
@@ -991,12 +976,12 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
991
976
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
992
977
|
this._skipFirstResize = function () {
|
|
993
978
|
var isFirstResize = true;
|
|
994
|
-
return function (
|
|
979
|
+
return function () {
|
|
995
980
|
if (isFirstResize) {
|
|
996
981
|
isFirstResize = false;
|
|
997
982
|
return;
|
|
998
983
|
}
|
|
999
|
-
_this._onResize(
|
|
984
|
+
_this._onResize();
|
|
1000
985
|
};
|
|
1001
986
|
}();
|
|
1002
987
|
this._flicking = flicking;
|
|
@@ -1014,7 +999,6 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
1014
999
|
configurable: true
|
|
1015
1000
|
});
|
|
1016
1001
|
__proto.enable = function () {
|
|
1017
|
-
var _this = this;
|
|
1018
1002
|
var flicking = this._flicking;
|
|
1019
1003
|
var viewport = flicking.viewport;
|
|
1020
1004
|
if (this._enabled) {
|
|
@@ -1022,32 +1006,23 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
1022
1006
|
}
|
|
1023
1007
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1024
1008
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1025
|
-
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(
|
|
1026
|
-
return _this._skipFirstResize(entries);
|
|
1027
|
-
}) : new ResizeObserver(function (entries) {
|
|
1028
|
-
return _this._onResize(entries);
|
|
1029
|
-
});
|
|
1009
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
|
|
1030
1010
|
resizeObserver.observe(flicking.viewport.element);
|
|
1031
1011
|
this._resizeObserver = resizeObserver;
|
|
1032
1012
|
} else {
|
|
1033
|
-
window.addEventListener("resize",
|
|
1034
|
-
return _this._onResize([]);
|
|
1035
|
-
});
|
|
1013
|
+
window.addEventListener("resize", this._onResize);
|
|
1036
1014
|
}
|
|
1037
1015
|
this._enabled = true;
|
|
1038
1016
|
return this;
|
|
1039
1017
|
};
|
|
1040
1018
|
__proto.disable = function () {
|
|
1041
|
-
var _this = this;
|
|
1042
1019
|
if (!this._enabled) return this;
|
|
1043
1020
|
var resizeObserver = this._resizeObserver;
|
|
1044
1021
|
if (resizeObserver) {
|
|
1045
1022
|
resizeObserver.disconnect();
|
|
1046
1023
|
this._resizeObserver = null;
|
|
1047
1024
|
} else {
|
|
1048
|
-
window.removeEventListener("resize",
|
|
1049
|
-
return _this._onResize([]);
|
|
1050
|
-
});
|
|
1025
|
+
window.removeEventListener("resize", this._onResize);
|
|
1051
1026
|
}
|
|
1052
1027
|
this._enabled = false;
|
|
1053
1028
|
return this;
|
|
@@ -2938,7 +2913,7 @@ var SnapControl = /*#__PURE__*/function (_super) {
|
|
|
2938
2913
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
2939
2914
|
// Move to anchor at position
|
|
2940
2915
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
2941
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
2916
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
|
|
2942
2917
|
// Move to the adjacent panel
|
|
2943
2918
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
2944
2919
|
} else {
|
|
@@ -2948,11 +2923,14 @@ var SnapControl = /*#__PURE__*/function (_super) {
|
|
|
2948
2923
|
axesEvent: axesEvent
|
|
2949
2924
|
});
|
|
2950
2925
|
}
|
|
2951
|
-
|
|
2926
|
+
var nextPanel = targetAnchor.panel;
|
|
2927
|
+
var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
|
|
2928
|
+
var nextPosition = this._getPosition(nextPanel, direction);
|
|
2929
|
+
this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
|
|
2952
2930
|
return this._animateToPosition({
|
|
2953
|
-
position: camera.clampToReachablePosition(
|
|
2931
|
+
position: camera.clampToReachablePosition(nextPosition),
|
|
2954
2932
|
duration: duration,
|
|
2955
|
-
newActivePanel:
|
|
2933
|
+
newActivePanel: nextPanel,
|
|
2956
2934
|
axesEvent: axesEvent
|
|
2957
2935
|
});
|
|
2958
2936
|
};
|
|
@@ -2962,12 +2940,13 @@ var SnapControl = /*#__PURE__*/function (_super) {
|
|
|
2962
2940
|
var count = this._count;
|
|
2963
2941
|
var currentPos = camera.position;
|
|
2964
2942
|
var clampedPosition = camera.clampToReachablePosition(position);
|
|
2943
|
+
var nearestAnchor = camera.findNearestAnchor(clampedPosition);
|
|
2965
2944
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
2966
|
-
if (!anchorAtCamera || !anchorAtPosition) {
|
|
2945
|
+
if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
|
|
2967
2946
|
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
|
|
2968
2947
|
}
|
|
2969
2948
|
if (!isFinite(count)) {
|
|
2970
|
-
return
|
|
2949
|
+
return nearestAnchor;
|
|
2971
2950
|
}
|
|
2972
2951
|
var panelCount = flicking.panelCount;
|
|
2973
2952
|
var anchors = camera.anchorPoints;
|
|
@@ -6134,7 +6113,6 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6134
6113
|
// Internal states
|
|
6135
6114
|
_this._initialized = false;
|
|
6136
6115
|
_this._plugins = [];
|
|
6137
|
-
_this._isResizing = false;
|
|
6138
6116
|
// Bind options
|
|
6139
6117
|
_this._align = align;
|
|
6140
6118
|
_this._defaultIndex = defaultIndex;
|
|
@@ -7674,8 +7652,6 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7674
7652
|
return __generator(this, function (_a) {
|
|
7675
7653
|
switch (_a.label) {
|
|
7676
7654
|
case 0:
|
|
7677
|
-
if (this._isResizing) return [2 /*return*/];
|
|
7678
|
-
this._isResizing = true;
|
|
7679
7655
|
viewport = this._viewport;
|
|
7680
7656
|
renderer = this._renderer;
|
|
7681
7657
|
camera = this._camera;
|
|
@@ -7728,7 +7704,6 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7728
7704
|
sizeChanged: sizeChanged,
|
|
7729
7705
|
element: viewport.element
|
|
7730
7706
|
}));
|
|
7731
|
-
this._isResizing = false;
|
|
7732
7707
|
return [2 /*return*/];
|
|
7733
7708
|
}
|
|
7734
7709
|
});
|
|
@@ -7856,7 +7831,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7856
7831
|
__proto._createCamera = function () {
|
|
7857
7832
|
if (this._circular && this._bound) {
|
|
7858
7833
|
// eslint-disable-next-line no-console
|
|
7859
|
-
console.warn(
|
|
7834
|
+
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
7860
7835
|
}
|
|
7861
7836
|
return new Camera(this, {
|
|
7862
7837
|
align: this._align
|
|
@@ -7866,7 +7841,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7866
7841
|
var externalRenderer = this._externalRenderer;
|
|
7867
7842
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
7868
7843
|
// eslint-disable-next-line no-console
|
|
7869
|
-
console.warn(
|
|
7844
|
+
console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
|
|
7870
7845
|
}
|
|
7871
7846
|
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
7872
7847
|
};
|
|
@@ -7948,7 +7923,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7948
7923
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7949
7924
|
* ```
|
|
7950
7925
|
*/
|
|
7951
|
-
Flicking.VERSION = "4.12.
|
|
7926
|
+
Flicking.VERSION = "4.12.1-beta.4";
|
|
7952
7927
|
return Flicking;
|
|
7953
7928
|
}(Component);
|
|
7954
7929
|
|