@egjs/flicking 4.10.5 → 4.10.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egjs/flicking",
3
- "version": "4.10.5",
3
+ "version": "4.10.6",
4
4
  "description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
5
5
  "main": "dist/flicking.js",
6
6
  "module": "dist/flicking.esm.js",
package/src/Flicking.ts CHANGED
@@ -1065,11 +1065,12 @@ class Flicking extends Component<FlickingEvents> {
1065
1065
  this.disableInput();
1066
1066
  }
1067
1067
  renderer.checkPanelContentsReady(renderer.panels);
1068
+ this._initialized = true;
1068
1069
 
1069
1070
  return renderer.render().then(() => {
1070
1071
  // Done initializing & emit ready event
1071
1072
  this._plugins.forEach(plugin => plugin.init(this));
1072
- this._initialized = true;
1073
+
1073
1074
  if (preventEventsBeforeInit) {
1074
1075
  this.trigger = originalTrigger;
1075
1076
  }
@@ -551,7 +551,7 @@ class Camera {
551
551
  const flicking = getFlickingAttached(this._flicking);
552
552
  const renderer = flicking.renderer;
553
553
 
554
- if (renderer.rendering) return this;
554
+ if (renderer.rendering || !flicking.initialized) return this;
555
555
 
556
556
  const actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
557
557
 
@@ -8,7 +8,7 @@ import Flicking from "../Flicking";
8
8
  import FlickingError from "../core/FlickingError";
9
9
  import * as AXES from "../const/axes";
10
10
  import * as ERROR from "../const/error";
11
- import { circulatePosition, getFlickingAttached, parseBounce } from "../utils";
11
+ import { getFlickingAttached, parseBounce } from "../utils";
12
12
  import { ControlParams } from "../type/external";
13
13
 
14
14
  import StateMachine from "./StateMachine";
@@ -376,37 +376,22 @@ class AxesController {
376
376
  }
377
377
  };
378
378
 
379
- if (duration === 0) {
380
- const flicking = getFlickingAttached(this._flicking);
381
- const camera = flicking.camera;
382
-
383
- animate();
379
+ return new Promise((resolve, reject) => {
380
+ const animationFinishHandler = () => {
381
+ axes.off(AXES.EVENT.HOLD, interruptionHandler);
382
+ resolve();
383
+ };
384
384
 
385
- const newPos = flicking.circularEnabled
386
- ? circulatePosition(position, camera.range.min, camera.range.max)
387
- : position;
385
+ const interruptionHandler = () => {
386
+ axes.off(AXES.EVENT.FINISH, animationFinishHandler);
387
+ reject(new FlickingError(ERROR.MESSAGE.ANIMATION_INTERRUPTED, ERROR.CODE.ANIMATION_INTERRUPTED));
388
+ };
388
389
 
389
- axes.axisManager.set({ [AXES.POSITION_KEY]: newPos });
390
+ axes.once(AXES.EVENT.FINISH, animationFinishHandler);
391
+ axes.once(AXES.EVENT.HOLD, interruptionHandler);
390
392
 
391
- return Promise.resolve();
392
- } else {
393
- return new Promise((resolve, reject) => {
394
- const animationFinishHandler = () => {
395
- axes.off(AXES.EVENT.HOLD, interruptionHandler);
396
- resolve();
397
- };
398
-
399
- const interruptionHandler = () => {
400
- axes.off(AXES.EVENT.FINISH, animationFinishHandler);
401
- reject(new FlickingError(ERROR.MESSAGE.ANIMATION_INTERRUPTED, ERROR.CODE.ANIMATION_INTERRUPTED));
402
- };
403
-
404
- axes.once(AXES.EVENT.FINISH, animationFinishHandler);
405
- axes.once(AXES.EVENT.HOLD, interruptionHandler);
406
-
407
- animate();
408
- });
409
- }
393
+ animate();
394
+ });
410
395
  }
411
396
 
412
397
  public updateDirection() {
@@ -536,6 +536,12 @@ abstract class Renderer {
536
536
  cameraElement.removeChild(panel.element);
537
537
  });
538
538
  }
539
+
540
+ protected _afterRender() {
541
+ const flicking = getFlickingAttached(this._flicking);
542
+
543
+ flicking.camera.applyTransform();
544
+ }
539
545
  }
540
546
 
541
547
  export default Renderer;
@@ -20,6 +20,7 @@ class VanillaRenderer extends Renderer {
20
20
  strategy.renderPanels(flicking);
21
21
 
22
22
  this._resetPanelElementOrder();
23
+ this._afterRender();
23
24
  }
24
25
 
25
26
  protected _collectPanels() {