@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.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(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
|
|
@@ -997,10 +997,25 @@ version: 4.12.1-beta.2
|
|
|
997
997
|
var AutoResizer = /*#__PURE__*/function () {
|
|
998
998
|
function AutoResizer(flicking) {
|
|
999
999
|
var _this = this;
|
|
1000
|
-
this._onResize = function () {
|
|
1000
|
+
this._onResize = function (entries) {
|
|
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
|
+
}
|
|
1004
1019
|
if (resizeDebounce <= 0) {
|
|
1005
1020
|
void flicking.resize();
|
|
1006
1021
|
} else {
|
|
@@ -1026,12 +1041,12 @@ version: 4.12.1-beta.2
|
|
|
1026
1041
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1027
1042
|
this._skipFirstResize = function () {
|
|
1028
1043
|
var isFirstResize = true;
|
|
1029
|
-
return function () {
|
|
1044
|
+
return function (entries) {
|
|
1030
1045
|
if (isFirstResize) {
|
|
1031
1046
|
isFirstResize = false;
|
|
1032
1047
|
return;
|
|
1033
1048
|
}
|
|
1034
|
-
_this._onResize();
|
|
1049
|
+
_this._onResize(entries);
|
|
1035
1050
|
};
|
|
1036
1051
|
}();
|
|
1037
1052
|
this._flicking = flicking;
|
|
@@ -1049,6 +1064,7 @@ version: 4.12.1-beta.2
|
|
|
1049
1064
|
configurable: true
|
|
1050
1065
|
});
|
|
1051
1066
|
__proto.enable = function () {
|
|
1067
|
+
var _this = this;
|
|
1052
1068
|
var flicking = this._flicking;
|
|
1053
1069
|
var viewport = flicking.viewport;
|
|
1054
1070
|
if (this._enabled) {
|
|
@@ -1056,23 +1072,32 @@ version: 4.12.1-beta.2
|
|
|
1056
1072
|
}
|
|
1057
1073
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
1058
1074
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
1059
|
-
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(
|
|
1075
|
+
var resizeObserver = viewportSizeNot0 ? new ResizeObserver(function (entries) {
|
|
1076
|
+
return _this._skipFirstResize(entries);
|
|
1077
|
+
}) : new ResizeObserver(function (entries) {
|
|
1078
|
+
return _this._onResize(entries);
|
|
1079
|
+
});
|
|
1060
1080
|
resizeObserver.observe(flicking.viewport.element);
|
|
1061
1081
|
this._resizeObserver = resizeObserver;
|
|
1062
1082
|
} else {
|
|
1063
|
-
window.addEventListener("resize",
|
|
1083
|
+
window.addEventListener("resize", function () {
|
|
1084
|
+
return _this._onResize([]);
|
|
1085
|
+
});
|
|
1064
1086
|
}
|
|
1065
1087
|
this._enabled = true;
|
|
1066
1088
|
return this;
|
|
1067
1089
|
};
|
|
1068
1090
|
__proto.disable = function () {
|
|
1091
|
+
var _this = this;
|
|
1069
1092
|
if (!this._enabled) return this;
|
|
1070
1093
|
var resizeObserver = this._resizeObserver;
|
|
1071
1094
|
if (resizeObserver) {
|
|
1072
1095
|
resizeObserver.disconnect();
|
|
1073
1096
|
this._resizeObserver = null;
|
|
1074
1097
|
} else {
|
|
1075
|
-
window.removeEventListener("resize",
|
|
1098
|
+
window.removeEventListener("resize", function () {
|
|
1099
|
+
return _this._onResize([]);
|
|
1100
|
+
});
|
|
1076
1101
|
}
|
|
1077
1102
|
this._enabled = false;
|
|
1078
1103
|
return this;
|
|
@@ -2963,9 +2988,8 @@ version: 4.12.1-beta.2
|
|
|
2963
2988
|
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
2964
2989
|
// Move to anchor at position
|
|
2965
2990
|
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
2966
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0
|
|
2991
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
2967
2992
|
// Move to the adjacent panel
|
|
2968
|
-
// console.log("moveToPosition anchorAtCamera activeAnchor absPosDelta", camera.position, anchorAtCamera, activeAnchor, absPosDelta, snapThreshold)
|
|
2969
2993
|
targetAnchor = this._findAdjacentAnchor(position, posDelta, anchorAtCamera);
|
|
2970
2994
|
} else {
|
|
2971
2995
|
// Fallback to nearest panel from current camera
|
|
@@ -3040,7 +3064,6 @@ version: 4.12.1-beta.2
|
|
|
3040
3064
|
return anchorIncludePosition;
|
|
3041
3065
|
}
|
|
3042
3066
|
}
|
|
3043
|
-
// console.log("_findAdjacentAnchor", position, posDelta, anchorAtCamera)
|
|
3044
3067
|
var adjacentAnchor = (_a = posDelta > 0 ? camera.getNextAnchor(anchorAtCamera) : camera.getPrevAnchor(anchorAtCamera)) !== null && _a !== void 0 ? _a : anchorAtCamera;
|
|
3045
3068
|
return adjacentAnchor;
|
|
3046
3069
|
};
|
|
@@ -6209,6 +6232,7 @@ version: 4.12.1-beta.2
|
|
|
6209
6232
|
// Internal states
|
|
6210
6233
|
_this._initialized = false;
|
|
6211
6234
|
_this._plugins = [];
|
|
6235
|
+
_this._isResizing = false;
|
|
6212
6236
|
// Bind options
|
|
6213
6237
|
_this._align = align;
|
|
6214
6238
|
_this._defaultIndex = defaultIndex;
|
|
@@ -7748,6 +7772,8 @@ version: 4.12.1-beta.2
|
|
|
7748
7772
|
return __generator(this, function (_a) {
|
|
7749
7773
|
switch (_a.label) {
|
|
7750
7774
|
case 0:
|
|
7775
|
+
if (this._isResizing) return [2 /*return*/];
|
|
7776
|
+
this._isResizing = true;
|
|
7751
7777
|
viewport = this._viewport;
|
|
7752
7778
|
renderer = this._renderer;
|
|
7753
7779
|
camera = this._camera;
|
|
@@ -7800,6 +7826,7 @@ version: 4.12.1-beta.2
|
|
|
7800
7826
|
sizeChanged: sizeChanged,
|
|
7801
7827
|
element: viewport.element
|
|
7802
7828
|
}));
|
|
7829
|
+
this._isResizing = false;
|
|
7803
7830
|
return [2 /*return*/];
|
|
7804
7831
|
}
|
|
7805
7832
|
});
|
|
@@ -7927,7 +7954,7 @@ version: 4.12.1-beta.2
|
|
|
7927
7954
|
__proto._createCamera = function () {
|
|
7928
7955
|
if (this._circular && this._bound) {
|
|
7929
7956
|
// eslint-disable-next-line no-console
|
|
7930
|
-
console.warn("
|
|
7957
|
+
console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
|
|
7931
7958
|
}
|
|
7932
7959
|
return new Camera$1(this, {
|
|
7933
7960
|
align: this._align
|
|
@@ -7937,7 +7964,7 @@ version: 4.12.1-beta.2
|
|
|
7937
7964
|
var externalRenderer = this._externalRenderer;
|
|
7938
7965
|
if (this._virtual && this._panelsPerView <= 0) {
|
|
7939
7966
|
// eslint-disable-next-line no-console
|
|
7940
|
-
console.warn("
|
|
7967
|
+
console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
|
|
7941
7968
|
}
|
|
7942
7969
|
return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
|
|
7943
7970
|
};
|
|
@@ -8019,7 +8046,7 @@ version: 4.12.1-beta.2
|
|
|
8019
8046
|
* Flicking.VERSION; // ex) 4.0.0
|
|
8020
8047
|
* ```
|
|
8021
8048
|
*/
|
|
8022
|
-
Flicking.VERSION = "4.12.
|
|
8049
|
+
Flicking.VERSION = "4.12.2-beta.0";
|
|
8023
8050
|
return Flicking;
|
|
8024
8051
|
}(Component);
|
|
8025
8052
|
|