@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.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
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
|
|
@@ -997,25 +997,10 @@ version: 4.12.2-beta.0
|
|
|
997
997
|
var AutoResizer = /*#__PURE__*/function () {
|
|
998
998
|
function AutoResizer(flicking) {
|
|
999
999
|
var _this = this;
|
|
1000
|
-
this._onResize = function (
|
|
1000
|
+
this._onResize = function () {
|
|
1001
1001
|
var flicking = _this._flicking;
|
|
1002
1002
|
var resizeDebounce = flicking.resizeDebounce;
|
|
1003
1003
|
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
1004
|
-
if (entries.length) {
|
|
1005
|
-
var resizeEntryInfo = entries[0].contentRect;
|
|
1006
|
-
var beforeSize = {
|
|
1007
|
-
width: flicking.viewport.width,
|
|
1008
|
-
height: flicking.viewport.height
|
|
1009
|
-
};
|
|
1010
|
-
var afterSize = {
|
|
1011
|
-
width: resizeEntryInfo.width,
|
|
1012
|
-
height: resizeEntryInfo.height
|
|
1013
|
-
};
|
|
1014
|
-
// resize 이벤트가 발생했으나 이전과 width, height의 변화가 없다면 이후 로직을 진행하지 않는다.
|
|
1015
|
-
if (beforeSize.height === afterSize.height && beforeSize.width === afterSize.width) {
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
1004
|
if (resizeDebounce <= 0) {
|
|
1020
1005
|
void flicking.resize();
|
|
1021
1006
|
} else {
|
|
@@ -1041,12 +1026,12 @@ version: 4.12.2-beta.0
|
|
|
1041
1026
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1042
1027
|
this._skipFirstResize = function () {
|
|
1043
1028
|
var isFirstResize = true;
|
|
1044
|
-
return function (
|
|
1029
|
+
return function () {
|
|
1045
1030
|
if (isFirstResize) {
|
|
1046
1031
|
isFirstResize = false;
|
|
1047
1032
|
return;
|
|
1048
1033
|
}
|
|
1049
|
-
_this._onResize(
|
|
1034
|
+
_this._onResize();
|
|
1050
1035
|
};
|
|
1051
1036
|
}();
|
|
1052
1037
|
this._flicking = flicking;
|
|
@@ -1064,7 +1049,6 @@ version: 4.12.2-beta.0
|
|
|
1064
1049
|
configurable: true
|
|
1065
1050
|
});
|
|
1066
1051
|
__proto.enable = function () {
|
|
1067
|
-
var _this = this;
|
|
1068
1052
|
var flicking = this._flicking;
|
|
1069
1053
|
var viewport = flicking.viewport;
|
|
1070
1054
|
if (this._enabled) {
|
|
@@ -1072,32 +1056,23 @@ version: 4.12.2-beta.0
|
|
|
1072
1056
|
}
|
|
1073
1057
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1074
1058
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1075
|
-
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(
|
|
1076
|
-
return _this._skipFirstResize(entries);
|
|
1077
|
-
}) : new ResizeObserver(function (entries) {
|
|
1078
|
-
return _this._onResize(entries);
|
|
1079
|
-
});
|
|
1059
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
|
|
1080
1060
|
resizeObserver.observe(flicking.viewport.element);
|
|
1081
1061
|
this._resizeObserver = resizeObserver;
|
|
1082
1062
|
} else {
|
|
1083
|
-
window.addEventListener("resize",
|
|
1084
|
-
return _this._onResize([]);
|
|
1085
|
-
});
|
|
1063
|
+
window.addEventListener("resize", this._onResize);
|
|
1086
1064
|
}
|
|
1087
1065
|
this._enabled = true;
|
|
1088
1066
|
return this;
|
|
1089
1067
|
};
|
|
1090
1068
|
__proto.disable = function () {
|
|
1091
|
-
var _this = this;
|
|
1092
1069
|
if (!this._enabled) return this;
|
|
1093
1070
|
var resizeObserver = this._resizeObserver;
|
|
1094
1071
|
if (resizeObserver) {
|
|
1095
1072
|
resizeObserver.disconnect();
|
|
1096
1073
|
this._resizeObserver = null;
|
|
1097
1074
|
} else {
|
|
1098
|
-
window.removeEventListener("resize",
|
|
1099
|
-
return _this._onResize([]);
|
|
1100
|
-
});
|
|
1075
|
+
window.removeEventListener("resize", this._onResize);
|
|
1101
1076
|
}
|
|
1102
1077
|
this._enabled = false;
|
|
1103
1078
|
return this;
|
|
@@ -2988,7 +2963,7 @@ version: 4.12.2-beta.0
|
|
|
2988
2963
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
2989
2964
|
// Move to anchor at position
|
|
2990
2965
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
2991
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
2966
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0 && anchorAtCamera === activeAnchor) {
|
|
2992
2967
|
// Move to the adjacent panel
|
|
2993
2968
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
2994
2969
|
} else {
|
|
@@ -2998,11 +2973,14 @@ version: 4.12.2-beta.0
|
|
|
2998
2973
|
axesEvent: axesEvent
|
|
2999
2974
|
});
|
|
3000
2975
|
}
|
|
3001
|
-
|
|
2976
|
+
var nextPanel = targetAnchor.panel;
|
|
2977
|
+
var direction = posDelta === 0 || activeAnchor === targetAnchor ? DIRECTION.NONE : posDelta > 0 ? DIRECTION.NEXT : DIRECTION.PREV;
|
|
2978
|
+
var nextPosition = this._getPosition(nextPanel, direction);
|
|
2979
|
+
this._triggerIndexChangeEvent(nextPanel, position, axesEvent);
|
|
3002
2980
|
return this._animateToPosition({
|
|
3003
|
-
position: camera.clampToReachablePosition(
|
|
2981
|
+
position: camera.clampToReachablePosition(nextPosition),
|
|
3004
2982
|
duration: duration,
|
|
3005
|
-
newActivePanel:
|
|
2983
|
+
newActivePanel: nextPanel,
|
|
3006
2984
|
axesEvent: axesEvent
|
|
3007
2985
|
});
|
|
3008
2986
|
};
|
|
@@ -3012,12 +2990,13 @@ version: 4.12.2-beta.0
|
|
|
3012
2990
|
var count = this._count;
|
|
3013
2991
|
var currentPos = camera.position;
|
|
3014
2992
|
var clampedPosition = camera.clampToReachablePosition(position);
|
|
2993
|
+
var nearestAnchor = camera.findNearestAnchor(clampedPosition);
|
|
3015
2994
|
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3016
|
-
if (!anchorAtCamera || !anchorAtPosition) {
|
|
2995
|
+
if (!anchorAtCamera || !anchorAtPosition || !nearestAnchor) {
|
|
3017
2996
|
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE);
|
|
3018
2997
|
}
|
|
3019
2998
|
if (!isFinite(count)) {
|
|
3020
|
-
return
|
|
2999
|
+
return nearestAnchor;
|
|
3021
3000
|
}
|
|
3022
3001
|
var panelCount = flicking.panelCount;
|
|
3023
3002
|
var anchors = camera.anchorPoints;
|
|
@@ -6232,7 +6211,6 @@ version: 4.12.2-beta.0
|
|
|
6232
6211
|
// Internal states
|
|
6233
6212
|
_this._initialized = false;
|
|
6234
6213
|
_this._plugins = [];
|
|
6235
|
-
_this._isResizing = false;
|
|
6236
6214
|
// Bind options
|
|
6237
6215
|
_this._align = align;
|
|
6238
6216
|
_this._defaultIndex = defaultIndex;
|
|
@@ -7772,8 +7750,6 @@ version: 4.12.2-beta.0
|
|
|
7772
7750
|
return __generator(this, function (_a) {
|
|
7773
7751
|
switch (_a.label) {
|
|
7774
7752
|
case 0:
|
|
7775
|
-
if (this._isResizing) return [2 /*return*/];
|
|
7776
|
-
this._isResizing = true;
|
|
7777
7753
|
viewport = this._viewport;
|
|
7778
7754
|
renderer = this._renderer;
|
|
7779
7755
|
camera = this._camera;
|
|
@@ -7826,7 +7802,6 @@ version: 4.12.2-beta.0
|
|
|
7826
7802
|
sizeChanged: sizeChanged,
|
|
7827
7803
|
element: viewport.element
|
|
7828
7804
|
}));
|
|
7829
|
-
this._isResizing = false;
|
|
7830
7805
|
return [2 /*return*/];
|
|
7831
7806
|
}
|
|
7832
7807
|
});
|
|
@@ -7954,7 +7929,7 @@ version: 4.12.2-beta.0
|
|
|
7954
7929
|
__proto._createCamera = function () {
|
|
7955
7930
|
if (this._circular && this._bound) {
|
|
7956
7931
|
// eslint-disable-next-line no-console
|
|
7957
|
-
console.warn(
|
|
7932
|
+
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
7958
7933
|
}
|
|
7959
7934
|
return new Camera$1(this, {
|
|
7960
7935
|
align: this._align
|
|
@@ -7964,7 +7939,7 @@ version: 4.12.2-beta.0
|
|
|
7964
7939
|
var externalRenderer = this._externalRenderer;
|
|
7965
7940
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
7966
7941
|
// eslint-disable-next-line no-console
|
|
7967
|
-
console.warn(
|
|
7942
|
+
console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
|
|
7968
7943
|
}
|
|
7969
7944
|
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
7970
7945
|
};
|
|
@@ -8046,7 +8021,7 @@ version: 4.12.2-beta.0
|
|
|
8046
8021
|
* Flicking.VERSION; // ex) 4.0.0
|
|
8047
8022
|
* ```
|
|
8048
8023
|
*/
|
|
8049
|
-
Flicking.VERSION = "4.12.
|
|
8024
|
+
Flicking.VERSION = "4.12.1-beta.4";
|
|
8050
8025
|
return Flicking;
|
|
8051
8026
|
}(Component);
|
|
8052
8027
|
|