@egjs/flicking 4.11.5-beta.0 → 4.11.5-beta.2

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.0
7
+ version: 4.11.5-beta.2
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.
@@ -970,13 +966,9 @@ var AutoResizer = /*#__PURE__*/function () {
970
966
  }
971
967
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
972
968
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
973
- 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) {
975
- return panel.element;
976
- })).forEach(function (element) {
977
- resizeObserver_1.observe(element);
978
- });
979
- 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;
980
972
  } else {
981
973
  window.addEventListener("resize", this._onResize);
982
974
  }
@@ -4074,6 +4066,8 @@ var Camera = /*#__PURE__*/function () {
4074
4066
  */
4075
4067
  __proto.lookAt = function (pos) {
4076
4068
  var _this = this;
4069
+ var prevOffset = this._offset;
4070
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4077
4071
  var flicking = getFlickingAttached(this._flicking);
4078
4072
  var prevPos = this._position;
4079
4073
  this._position = pos;
@@ -4081,10 +4075,15 @@ var Camera = /*#__PURE__*/function () {
4081
4075
  this._refreshVisiblePanels();
4082
4076
  this._checkNeedPanel();
4083
4077
  this._checkReachEnd(prevPos, pos);
4084
- if (toggled) {
4078
+ if (isChangedOffset || toggled) {
4085
4079
  void flicking.renderer.render().then(function () {
4086
4080
  _this.updateOffset();
4081
+ _this._lookedOffset = _this._offset;
4087
4082
  });
4083
+ } else if (isChangedOffset) {
4084
+ // sync offset for renderOnlyVisible on resize
4085
+ this.updateOffset();
4086
+ this._lookedOffset = this._offset;
4088
4087
  } else {
4089
4088
  this.applyTransform();
4090
4089
  }
@@ -4768,9 +4767,6 @@ var Renderer = /*#__PURE__*/function () {
4768
4767
  var activePanel = control.activePanel;
4769
4768
  // Update camera & control
4770
4769
  this._updateCameraAndControl();
4771
- if (flicking.autoResize) {
4772
- flicking.autoResizer.enable();
4773
- }
4774
4770
  void this.render();
4775
4771
  if (!flicking.animating) {
4776
4772
  if (!activePanel || activePanel.removed) {
@@ -6172,13 +6168,6 @@ var Flicking = /*#__PURE__*/function (_super) {
6172
6168
  enumerable: false,
6173
6169
  configurable: true
6174
6170
  });
6175
- Object.defineProperty(__proto, "autoResizer", {
6176
- get: function () {
6177
- return this._autoResizer;
6178
- },
6179
- enumerable: false,
6180
- configurable: true
6181
- });
6182
6171
  Object.defineProperty(__proto, "initialized", {
6183
6172
  // Internal States
6184
6173
  /**
@@ -7850,7 +7839,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7850
7839
  * Flicking.VERSION; // ex) 4.0.0
7851
7840
  * ```
7852
7841
  */
7853
- Flicking.VERSION = "4.11.5-beta.0";
7842
+ Flicking.VERSION = "4.11.5-beta.2";
7854
7843
  return Flicking;
7855
7844
  }(Component);
7856
7845