@egjs/flicking 4.11.5-beta.1 → 4.11.5-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,13 +4,13 @@ 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.1
7
+ version: 4.11.5-beta.3
8
8
  */
9
9
  import Component, { ComponentEvent } from '@egjs/component';
10
10
  import Axes, { PanInput } from '@egjs/axes';
11
11
  import ImReady from '@egjs/imready';
12
12
 
13
- /******************************************************************************
13
+ /*! *****************************************************************************
14
14
  Copyright (c) Microsoft Corporation.
15
15
 
16
16
  Permission to use, copy, modify, and/or distribute this software for any
@@ -24,7 +24,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
24
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
25
  PERFORMANCE OF THIS SOFTWARE.
26
26
  ***************************************************************************** */
27
- /* global Reflect, Promise, SuppressedError, Symbol */
27
+ /* global Reflect, Promise */
28
28
 
29
29
  var extendStatics = function (d, b) {
30
30
  extendStatics = Object.setPrototypeOf || {
@@ -109,7 +109,7 @@ function __generator(thisArg, body) {
109
109
  }
110
110
  function step(op) {
111
111
  if (f) throw new TypeError("Generator is already executing.");
112
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
112
+ while (_) try {
113
113
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
114
114
  if (y = 0, t) op = [op[0] & 2, t.value];
115
115
  switch (op[0]) {
@@ -213,10 +213,6 @@ function __spread() {
213
213
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
214
214
  return ar;
215
215
  }
216
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
217
- var e = new Error(message);
218
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
219
- };
220
216
 
221
217
  /*
222
218
  * Copyright (c) 2015 NAVER Corp.
@@ -908,10 +904,6 @@ var Viewport = /*#__PURE__*/function () {
908
904
  return Viewport;
909
905
  }();
910
906
 
911
- /**
912
- * A component that detects size change and trigger resize method when the autoResize option is used
913
- * @ko autoResize 옵션을 사용할 때 크기 변화를 감지하고 Flicking의 resize를 호출하는 컴포넌트
914
- */
915
907
  var AutoResizer = /*#__PURE__*/function () {
916
908
  function AutoResizer(flicking) {
917
909
  var _this = this;
@@ -974,13 +966,9 @@ var AutoResizer = /*#__PURE__*/function () {
974
966
  }
975
967
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
976
968
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
977
- var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
978
- __spread([flicking.viewport.element, flicking.camera.element], flicking.panels.map(function (panel) {
979
- return panel.element;
980
- })).forEach(function (element) {
981
- resizeObserver_1.observe(element);
982
- });
983
- this._resizeObserver = resizeObserver_1;
969
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
970
+ resizeObserver.observe(flicking.viewport.element);
971
+ this._resizeObserver = resizeObserver;
984
972
  } else {
985
973
  window.addEventListener("resize", this._onResize);
986
974
  }
@@ -999,12 +987,6 @@ var AutoResizer = /*#__PURE__*/function () {
999
987
  this._enabled = false;
1000
988
  return this;
1001
989
  };
1002
- __proto.observe = function (element) {
1003
- if (this._resizeObserver) {
1004
- this._resizeObserver.observe(element);
1005
- }
1006
- return this;
1007
- };
1008
990
  return AutoResizer;
1009
991
  }();
1010
992
 
@@ -3725,6 +3707,7 @@ var Camera = /*#__PURE__*/function () {
3725
3707
  var _this = this;
3726
3708
  var _b = (_a === void 0 ? {} : _a).align,
3727
3709
  align = _b === void 0 ? ALIGN.CENTER : _b;
3710
+ this._lookedOffset = 0;
3728
3711
  this._checkTranslateSupport = function () {
3729
3712
  var e_1, _a;
3730
3713
  var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
@@ -4084,6 +4067,8 @@ var Camera = /*#__PURE__*/function () {
4084
4067
  */
4085
4068
  __proto.lookAt = function (pos) {
4086
4069
  var _this = this;
4070
+ var prevOffset = this._offset;
4071
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4087
4072
  var flicking = getFlickingAttached(this._flicking);
4088
4073
  var prevPos = this._position;
4089
4074
  this._position = pos;
@@ -4091,10 +4076,15 @@ var Camera = /*#__PURE__*/function () {
4091
4076
  this._refreshVisiblePanels();
4092
4077
  this._checkNeedPanel();
4093
4078
  this._checkReachEnd(prevPos, pos);
4094
- if (toggled) {
4079
+ if (isChangedOffset || toggled) {
4095
4080
  void flicking.renderer.render().then(function () {
4096
4081
  _this.updateOffset();
4082
+ _this._lookedOffset = _this._offset;
4097
4083
  });
4084
+ } else if (isChangedOffset) {
4085
+ // sync offset for renderOnlyVisible on resize
4086
+ this.updateOffset();
4087
+ this._lookedOffset = this._offset;
4098
4088
  } else {
4099
4089
  this.applyTransform();
4100
4090
  }
@@ -4353,6 +4343,7 @@ var Camera = /*#__PURE__*/function () {
4353
4343
  };
4354
4344
  __proto._resetInternalValues = function () {
4355
4345
  this._position = 0;
4346
+ this._lookedOffset = 0;
4356
4347
  this._alignPos = 0;
4357
4348
  this._offset = 0;
4358
4349
  this._circularOffset = 0;
@@ -4778,11 +4769,6 @@ var Renderer = /*#__PURE__*/function () {
4778
4769
  var activePanel = control.activePanel;
4779
4770
  // Update camera & control
4780
4771
  this._updateCameraAndControl();
4781
- if (flicking.autoResize && flicking.useResizeObserver) {
4782
- panelsAdded.forEach(function (panel) {
4783
- flicking.autoResizer.observe(panel.element);
4784
- });
4785
- }
4786
4772
  void this.render();
4787
4773
  if (!flicking.animating) {
4788
4774
  if (!activePanel || activePanel.removed) {
@@ -6184,19 +6170,6 @@ var Flicking = /*#__PURE__*/function (_super) {
6184
6170
  enumerable: false,
6185
6171
  configurable: true
6186
6172
  });
6187
- Object.defineProperty(__proto, "autoResizer", {
6188
- /**
6189
- * {@link AutoResizer} instance of the Flicking
6190
- * @ko 현재 Flicking에 활성화된 {@link AutoResizer} 인스턴스
6191
- * @internal
6192
- * @readonly
6193
- */
6194
- get: function () {
6195
- return this._autoResizer;
6196
- },
6197
- enumerable: false,
6198
- configurable: true
6199
- });
6200
6173
  Object.defineProperty(__proto, "initialized", {
6201
6174
  // Internal States
6202
6175
  /**
@@ -7049,9 +7022,6 @@ var Flicking = /*#__PURE__*/function (_super) {
7049
7022
  // OTHERS
7050
7023
  set: function (val) {
7051
7024
  this._autoResize = val;
7052
- if (!this._initialized) {
7053
- return;
7054
- }
7055
7025
  if (val) {
7056
7026
  this._autoResizer.enable();
7057
7027
  } else {
@@ -7074,7 +7044,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7074
7044
  },
7075
7045
  set: function (val) {
7076
7046
  this._useResizeObserver = val;
7077
- if (this._initialized && this._autoResize) {
7047
+ if (this._autoResize) {
7078
7048
  this._autoResizer.enable();
7079
7049
  }
7080
7050
  },
@@ -7871,7 +7841,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7871
7841
  * Flicking.VERSION; // ex) 4.0.0
7872
7842
  * ```
7873
7843
  */
7874
- Flicking.VERSION = "4.11.5-beta.1";
7844
+ Flicking.VERSION = "4.11.5-beta.3";
7875
7845
  return Flicking;
7876
7846
  }(Component);
7877
7847