@egjs/flicking 4.12.1-beta.1 → 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.
@@ -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.1-beta.1
7
+ version: 4.12.2-beta.0
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
@@ -947,10 +947,25 @@ 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 (entries) {
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
+ }
954
969
  if (resizeDebounce <= 0) {
955
970
  void flicking.resize();
956
971
  } else {
@@ -976,12 +991,12 @@ var AutoResizer = /*#__PURE__*/function () {
976
991
  // eslint-disable-next-line @typescript-eslint/member-ordering
977
992
  this._skipFirstResize = function () {
978
993
  var isFirstResize = true;
979
- return function () {
994
+ return function (entries) {
980
995
  if (isFirstResize) {
981
996
  isFirstResize = false;
982
997
  return;
983
998
  }
984
- _this._onResize();
999
+ _this._onResize(entries);
985
1000
  };
986
1001
  }();
987
1002
  this._flicking = flicking;
@@ -999,6 +1014,7 @@ var AutoResizer = /*#__PURE__*/function () {
999
1014
  configurable: true
1000
1015
  });
1001
1016
  __proto.enable = function () {
1017
+ var _this = this;
1002
1018
  var flicking = this._flicking;
1003
1019
  var viewport = flicking.viewport;
1004
1020
  if (this._enabled) {
@@ -1006,23 +1022,32 @@ var AutoResizer = /*#__PURE__*/function () {
1006
1022
  }
1007
1023
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
1008
1024
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
1009
- var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
1025
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(function (entries) {
1026
+ return _this._skipFirstResize(entries);
1027
+ }) : new ResizeObserver(function (entries) {
1028
+ return _this._onResize(entries);
1029
+ });
1010
1030
  resizeObserver.observe(flicking.viewport.element);
1011
1031
  this._resizeObserver = resizeObserver;
1012
1032
  } else {
1013
- window.addEventListener("resize", this._onResize);
1033
+ window.addEventListener("resize", function () {
1034
+ return _this._onResize([]);
1035
+ });
1014
1036
  }
1015
1037
  this._enabled = true;
1016
1038
  return this;
1017
1039
  };
1018
1040
  __proto.disable = function () {
1041
+ var _this = this;
1019
1042
  if (!this._enabled) return this;
1020
1043
  var resizeObserver = this._resizeObserver;
1021
1044
  if (resizeObserver) {
1022
1045
  resizeObserver.disconnect();
1023
1046
  this._resizeObserver = null;
1024
1047
  } else {
1025
- window.removeEventListener("resize", this._onResize);
1048
+ window.removeEventListener("resize", function () {
1049
+ return _this._onResize([]);
1050
+ });
1026
1051
  }
1027
1052
  this._enabled = false;
1028
1053
  return this;
@@ -6109,6 +6134,7 @@ var Flicking = /*#__PURE__*/function (_super) {
6109
6134
  // Internal states
6110
6135
  _this._initialized = false;
6111
6136
  _this._plugins = [];
6137
+ _this._isResizing = false;
6112
6138
  // Bind options
6113
6139
  _this._align = align;
6114
6140
  _this._defaultIndex = defaultIndex;
@@ -7648,6 +7674,8 @@ var Flicking = /*#__PURE__*/function (_super) {
7648
7674
  return __generator(this, function (_a) {
7649
7675
  switch (_a.label) {
7650
7676
  case 0:
7677
+ if (this._isResizing) return [2 /*return*/];
7678
+ this._isResizing = true;
7651
7679
  viewport = this._viewport;
7652
7680
  renderer = this._renderer;
7653
7681
  camera = this._camera;
@@ -7700,6 +7728,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7700
7728
  sizeChanged: sizeChanged,
7701
7729
  element: viewport.element
7702
7730
  }));
7731
+ this._isResizing = false;
7703
7732
  return [2 /*return*/];
7704
7733
  }
7705
7734
  });
@@ -7827,7 +7856,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7827
7856
  __proto._createCamera = function () {
7828
7857
  if (this._circular && this._bound) {
7829
7858
  // eslint-disable-next-line no-console
7830
- console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
7859
+ console.warn('"circular" and "bound" option cannot be used together, ignoring bound.');
7831
7860
  }
7832
7861
  return new Camera(this, {
7833
7862
  align: this._align
@@ -7837,7 +7866,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7837
7866
  var externalRenderer = this._externalRenderer;
7838
7867
  if (this._virtual && this._panelsPerView <= 0) {
7839
7868
  // eslint-disable-next-line no-console
7840
- console.warn("\"virtual\" and \"panelsPerView\" option should be used together, ignoring virtual.");
7869
+ console.warn('"virtual" and "panelsPerView" option should be used together, ignoring virtual.');
7841
7870
  }
7842
7871
  return externalRenderer ? externalRenderer : this._renderExternal ? this._createExternalRenderer() : this._createVanillaRenderer();
7843
7872
  };
@@ -7919,7 +7948,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7919
7948
  * Flicking.VERSION; // ex) 4.0.0
7920
7949
  * ```
7921
7950
  */
7922
- Flicking.VERSION = "4.12.1-beta.1";
7951
+ Flicking.VERSION = "4.12.2-beta.0";
7923
7952
  return Flicking;
7924
7953
  }(Component);
7925
7954