@egjs/flicking 4.11.5-beta.0 → 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.
@@ -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.5-beta.0
7
+ version: 4.11.5-beta.1
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -908,6 +908,10 @@ var Viewport = /*#__PURE__*/function () {
908
908
  return Viewport;
909
909
  }();
910
910
 
911
+ /**
912
+ * A component that detects size change and trigger resize method when the autoResize option is used
913
+ * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
914
+ */
911
915
  var AutoResizer = /*#__PURE__*/function () {
912
916
  function AutoResizer(flicking) {
913
917
  var _this = this;
@@ -971,7 +975,7 @@ var AutoResizer = /*#__PURE__*/function () {
971
975
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
972
976
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
973
977
  var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
974
- __spread([flicking.viewport.element], flicking.camera.element ? [flicking.camera.element] : [], flicking.panels.map(function (panel) {
978
+ __spread([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
975
979
  return panel.element;
976
980
  })).forEach(function (element) {
977
981
  resizeObserver_1.observe(element);
@@ -995,6 +999,12 @@ var AutoResizer = /*#__PURE__*/function () {
995
999
  this._enabled = false;
996
1000
  return this;
997
1001
  };
1002
+ __proto.observe = function (element) {
1003
+ if (this._resizeObserver) {
1004
+ this._resizeObserver.observe(element);
1005
+ }
1006
+ return this;
1007
+ };
998
1008
  return AutoResizer;
999
1009
  }();
1000
1010
 
@@ -4768,8 +4778,10 @@ var Renderer = /*#__PURE__*/function () {
4768
4778
  var activePanel = control.activePanel;
4769
4779
  // Update camera & control
4770
4780
  this._updateCameraAndControl();
4771
- if (flicking.autoResize) {
4772
- flicking.autoResizer.enable();
4781
+ if (flicking.autoResize && flicking.useResizeObserver) {
4782
+ panelsAdded.forEach(function (panel) {
4783
+ flicking.autoResizer.observe(panel.element);
4784
+ });
4773
4785
  }
4774
4786
  void this.render();
4775
4787
  if (!flicking.animating) {
@@ -6173,6 +6185,12 @@ var Flicking = /*#__PURE__*/function (_super) {
6173
6185
  configurable: true
6174
6186
  });
6175
6187
  Object.defineProperty(__proto, "autoResizer", {
6188
+ /**
6189
+ * {@link AutoResizer} instance of the Flicking
6190
+ * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
6191
+ * @internal
6192
+ * @readonly
6193
+ */
6176
6194
  get: function () {
6177
6195
  return this._autoResizer;
6178
6196
  },
@@ -7031,6 +7049,9 @@ var Flicking = /*#__PURE__*/function (_super) {
7031
7049
  // OTHERS
7032
7050
  set: function (val) {
7033
7051
  this._autoResize = val;
7052
+ if (!this._initialized) {
7053
+ return;
7054
+ }
7034
7055
  if (val) {
7035
7056
  this._autoResizer.enable();
7036
7057
  } else {
@@ -7053,7 +7074,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7053
7074
  },
7054
7075
  set: function (val) {
7055
7076
  this._useResizeObserver = val;
7056
- if (this._autoResize) {
7077
+ if (this._initialized && this._autoResize) {
7057
7078
  this._autoResizer.enable();
7058
7079
  }
7059
7080
  },
@@ -7850,7 +7871,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7850
7871
  * Flicking.VERSION; // ex) 4.0.0
7851
7872
  * ```
7852
7873
  */
7853
- Flicking.VERSION = "4.11.5-beta.0";
7874
+ Flicking.VERSION = "4.11.5-beta.1";
7854
7875
  return Flicking;
7855
7876
  }(Component);
7856
7877