@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.
@@ -1,6 +1,5 @@
1
1
  import Component from "@egjs/component";
2
2
  import Viewport from "./core/Viewport";
3
- import AutoResizer from "./core/AutoResizer";
4
3
  import { Panel } from "./core/panel";
5
4
  import VirtualManager, { VirtualOptions } from "./core/VirtualManager";
6
5
  import { Control } from "./control";
@@ -123,7 +122,6 @@ declare class Flicking extends Component<FlickingEvents> {
123
122
  get camera(): Camera;
124
123
  get renderer(): Renderer;
125
124
  get viewport(): Viewport;
126
- get autoResizer(): AutoResizer;
127
125
  get initialized(): boolean;
128
126
  get circularEnabled(): boolean;
129
127
  get virtualEnabled(): boolean;
@@ -12,6 +12,7 @@ declare class Camera {
12
12
  private _mode;
13
13
  private _el;
14
14
  private _transform;
15
+ private _lookedOffset;
15
16
  private _position;
16
17
  private _alignPos;
17
18
  private _offset;
@@ -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.2
8
8
  */
9
9
  'use strict';
10
10
 
@@ -12,7 +12,7 @@ var Component = require('@egjs/component');
12
12
  var Axes = require('@egjs/axes');
13
13
  var ImReady = require('@egjs/imready');
14
14
 
15
- /******************************************************************************
15
+ /*! *****************************************************************************
16
16
  Copyright (c) Microsoft Corporation.
17
17
 
18
18
  Permission to use, copy, modify, and/or distribute this software for any
@@ -26,7 +26,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
26
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
27
  PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
- /* global Reflect, Promise, SuppressedError, Symbol */
29
+ /* global Reflect, Promise */
30
30
 
31
31
  var extendStatics = function (d, b) {
32
32
  extendStatics = Object.setPrototypeOf || {
@@ -111,7 +111,7 @@ function __generator(thisArg, body) {
111
111
  }
112
112
  function step(op) {
113
113
  if (f) throw new TypeError("Generator is already executing.");
114
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
114
+ while (_) try {
115
115
  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;
116
116
  if (y = 0, t) op = [op[0] & 2, t.value];
117
117
  switch (op[0]) {
@@ -215,10 +215,6 @@ function __spread() {
215
215
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
216
216
  return ar;
217
217
  }
218
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
219
- var e = new Error(message);
220
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
221
- };
222
218
 
223
219
  /*
224
220
  * Copyright (c) 2015 NAVER Corp.
@@ -972,13 +968,9 @@ var AutoResizer = /*#__PURE__*/function () {
972
968
  }
973
969
  if (flicking.useResizeObserver && !!window.ResizeObserver) {
974
970
  var viewportSizeNot0 = viewport.width !== 0 || viewport.height !== 0;
975
- var resizeObserver_1 = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
976
- __spread([flicking.viewport.element], flicking.camera.element ? [flicking.camera.element] : [], flicking.panels.map(function (panel) {
977
- return panel.element;
978
- })).forEach(function (element) {
979
- resizeObserver_1.observe(element);
980
- });
981
- this._resizeObserver = resizeObserver_1;
971
+ var resizeObserver = viewportSizeNot0 ? new ResizeObserver(this._skipFirstResize) : new ResizeObserver(this._onResize);
972
+ resizeObserver.observe(flicking.viewport.element);
973
+ this._resizeObserver = resizeObserver;
982
974
  } else {
983
975
  window.addEventListener("resize", this._onResize);
984
976
  }
@@ -4076,6 +4068,8 @@ var Camera = /*#__PURE__*/function () {
4076
4068
  */
4077
4069
  __proto.lookAt = function (pos) {
4078
4070
  var _this = this;
4071
+ var prevOffset = this._offset;
4072
+ var isChangedOffset = this._lookedOffset !== prevOffset;
4079
4073
  var flicking = getFlickingAttached(this._flicking);
4080
4074
  var prevPos = this._position;
4081
4075
  this._position = pos;
@@ -4083,10 +4077,15 @@ var Camera = /*#__PURE__*/function () {
4083
4077
  this._refreshVisiblePanels();
4084
4078
  this._checkNeedPanel();
4085
4079
  this._checkReachEnd(prevPos, pos);
4086
- if (toggled) {
4080
+ if (isChangedOffset || toggled) {
4087
4081
  void flicking.renderer.render().then(function () {
4088
4082
  _this.updateOffset();
4083
+ _this._lookedOffset = _this._offset;
4089
4084
  });
4085
+ } else if (isChangedOffset) {
4086
+ // sync offset for renderOnlyVisible on resize
4087
+ this.updateOffset();
4088
+ this._lookedOffset = this._offset;
4090
4089
  } else {
4091
4090
  this.applyTransform();
4092
4091
  }
@@ -4770,9 +4769,6 @@ var Renderer = /*#__PURE__*/function () {
4770
4769
  var activePanel = control.activePanel;
4771
4770
  // Update camera & control
4772
4771
  this._updateCameraAndControl();
4773
- if (flicking.autoResize) {
4774
- flicking.autoResizer.enable();
4775
- }
4776
4772
  void this.render();
4777
4773
  if (!flicking.animating) {
4778
4774
  if (!activePanel || activePanel.removed) {
@@ -6174,13 +6170,6 @@ var Flicking = /*#__PURE__*/function (_super) {
6174
6170
  enumerable: false,
6175
6171
  configurable: true
6176
6172
  });
6177
- Object.defineProperty(__proto, "autoResizer", {
6178
- get: function () {
6179
- return this._autoResizer;
6180
- },
6181
- enumerable: false,
6182
- configurable: true
6183
- });
6184
6173
  Object.defineProperty(__proto, "initialized", {
6185
6174
  // Internal States
6186
6175
  /**
@@ -7852,7 +7841,7 @@ var Flicking = /*#__PURE__*/function (_super) {
7852
7841
  * Flicking.VERSION; // ex) 4.0.0
7853
7842
  * ```
7854
7843
  */
7855
- Flicking.VERSION = "4.11.5-beta.0";
7844
+ Flicking.VERSION = "4.11.5-beta.2";
7856
7845
  return Flicking;
7857
7846
  }(Component);
7858
7847