@egjs/flicking 4.11.4 → 4.11.5-beta.1
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 -0
- package/declaration/core/AutoResizer.d.ts +1 -0
- package/dist/flicking.cjs.js +41 -6
- package/dist/flicking.cjs.js.map +1 -1
- package/dist/flicking.esm.js +41 -6
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +41 -6
- 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 +41 -6
- 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 +1 -1
- package/src/Flicking.ts +12 -1
- package/src/core/AutoResizer.ts +16 -1
- package/src/renderer/Renderer.ts +6 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Component from "@egjs/component";
|
|
2
2
|
import Viewport from "./core/Viewport";
|
|
3
|
+
import AutoResizer from "./core/AutoResizer";
|
|
3
4
|
import { Panel } from "./core/panel";
|
|
4
5
|
import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
|
|
5
6
|
import { Control } from "./control";
|
|
@@ -122,6 +123,7 @@ declare class Flicking extends Component<FlickingEvents> {
|
|
|
122
123
|
get camera(): Camera;
|
|
123
124
|
get renderer(): Renderer;
|
|
124
125
|
get viewport(): Viewport;
|
|
126
|
+
get autoResizer(): AutoResizer;
|
|
125
127
|
get initialized(): boolean;
|
|
126
128
|
get circularEnabled(): boolean;
|
|
127
129
|
get virtualEnabled(): boolean;
|
package/dist/flicking.cjs.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.11.
|
|
7
|
+
version: 4.11.5-beta.1
|
|
8
8
|
*/
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -910,6 +910,10 @@ var Viewport = /*#__PURE__*/function () {
|
|
|
910
910
|
return Viewport;
|
|
911
911
|
}();
|
|
912
912
|
|
|
913
|
+
/**
|
|
914
|
+
* A component that detects size change and trigger resize method when the autoResize option is used
|
|
915
|
+
* @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
|
|
916
|
+
*/
|
|
913
917
|
var AutoResizer = /*#__PURE__*/function () {
|
|
914
918
|
function AutoResizer(flicking) {
|
|
915
919
|
var _this = this;
|
|
@@ -972,9 +976,13 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
972
976
|
}
|
|
973
977
|
if (flicking.useResizeObserver && !!window.ResizeObserver) {
|
|
974
978
|
var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
|
|
975
|
-
var
|
|
976
|
-
|
|
977
|
-
|
|
979
|
+
var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
|
|
980
|
+
__spread([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
|
|
981
|
+
return panel.element;
|
|
982
|
+
})).forEach(function (element) {
|
|
983
|
+
resizeObserver_1.observe(element);
|
|
984
|
+
});
|
|
985
|
+
this._resizeObserver = resizeObserver_1;
|
|
978
986
|
} else {
|
|
979
987
|
window.addEventListener("resize", this._onResize);
|
|
980
988
|
}
|
|
@@ -993,6 +1001,12 @@ var AutoResizer = /*#__PURE__*/function () {
|
|
|
993
1001
|
this._enabled = false;
|
|
994
1002
|
return this;
|
|
995
1003
|
};
|
|
1004
|
+
__proto.observe = function (element) {
|
|
1005
|
+
if (this._resizeObserver) {
|
|
1006
|
+
this._resizeObserver.observe(element);
|
|
1007
|
+
}
|
|
1008
|
+
return this;
|
|
1009
|
+
};
|
|
996
1010
|
return AutoResizer;
|
|
997
1011
|
}();
|
|
998
1012
|
|
|
@@ -4766,6 +4780,11 @@ var Renderer = /*#__PURE__*/function () {
|
|
|
4766
4780
|
var activePanel = control.activePanel;
|
|
4767
4781
|
// Update camera & control
|
|
4768
4782
|
this._updateCameraAndControl();
|
|
4783
|
+
if (flicking.autoResize && flicking.useResizeObserver) {
|
|
4784
|
+
panelsAdded.forEach(function (panel) {
|
|
4785
|
+
flicking.autoResizer.observe(panel.element);
|
|
4786
|
+
});
|
|
4787
|
+
}
|
|
4769
4788
|
void this.render();
|
|
4770
4789
|
if (!flicking.animating) {
|
|
4771
4790
|
if (!activePanel || activePanel.removed) {
|
|
@@ -6167,6 +6186,19 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
6167
6186
|
enumerable: false,
|
|
6168
6187
|
configurable: true
|
|
6169
6188
|
});
|
|
6189
|
+
Object.defineProperty(__proto, "autoResizer", {
|
|
6190
|
+
/**
|
|
6191
|
+
* {@link AutoResizer} instance of the Flicking
|
|
6192
|
+
* @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
|
|
6193
|
+
* @internal
|
|
6194
|
+
* @readonly
|
|
6195
|
+
*/
|
|
6196
|
+
get: function () {
|
|
6197
|
+
return this._autoResizer;
|
|
6198
|
+
},
|
|
6199
|
+
enumerable: false,
|
|
6200
|
+
configurable: true
|
|
6201
|
+
});
|
|
6170
6202
|
Object.defineProperty(__proto, "initialized", {
|
|
6171
6203
|
// Internal States
|
|
6172
6204
|
/**
|
|
@@ -7019,6 +7051,9 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7019
7051
|
// OTHERS
|
|
7020
7052
|
set: function (val) {
|
|
7021
7053
|
this._autoResize = val;
|
|
7054
|
+
if (!this._initialized) {
|
|
7055
|
+
return;
|
|
7056
|
+
}
|
|
7022
7057
|
if (val) {
|
|
7023
7058
|
this._autoResizer.enable();
|
|
7024
7059
|
} else {
|
|
@@ -7041,7 +7076,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7041
7076
|
},
|
|
7042
7077
|
set: function (val) {
|
|
7043
7078
|
this._useResizeObserver = val;
|
|
7044
|
-
if (this._autoResize) {
|
|
7079
|
+
if (this._initialized && this._autoResize) {
|
|
7045
7080
|
this._autoResizer.enable();
|
|
7046
7081
|
}
|
|
7047
7082
|
},
|
|
@@ -7838,7 +7873,7 @@ var Flicking = /*#__PURE__*/function (_super) {
|
|
|
7838
7873
|
* Flicking.VERSION; // ex) 4.0.0
|
|
7839
7874
|
* ```
|
|
7840
7875
|
*/
|
|
7841
|
-
Flicking.VERSION = "4.11.
|
|
7876
|
+
Flicking.VERSION = "4.11.5-beta.1";
|
|
7842
7877
|
return Flicking;
|
|
7843
7878
|
}(Component);
|
|
7844
7879
|
|