@egjs/flicking 4.11.0 → 4.11.1

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/dist/flicking.js CHANGED
@@ -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.0
7
+ version: 4.11.1
8
8
  */
9
9
  (function (global, factory) {
10
10
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
@@ -398,6 +398,17 @@ version: 4.11.0
398
398
  LINEAR: "linear",
399
399
  BOUND: "bound"
400
400
  };
401
+ /**
402
+ * An object for identifying {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
403
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성을 구분하기 위한 객체
404
+ * @type {object}
405
+ * @property {string} LTR "ltr"
406
+ * @property {string} RTL "rtl"
407
+ */
408
+ var ORDER = {
409
+ LTR: "ltr",
410
+ RTL: "rtl"
411
+ };
401
412
 
402
413
  var Constants = {
403
414
  __proto__: null,
@@ -407,6 +418,7 @@ version: 4.11.0
407
418
  MOVE_TYPE: MOVE_TYPE,
408
419
  CLASS: CLASS,
409
420
  CIRCULAR_FALLBACK: CIRCULAR_FALLBACK,
421
+ ORDER: ORDER,
410
422
  ERROR_CODE: CODE
411
423
  };
412
424
 
@@ -702,20 +714,22 @@ version: 4.11.0
702
714
  useFractionalSize = _a.useFractionalSize,
703
715
  useOffset = _a.useOffset,
704
716
  style = _a.style;
717
+ var size = 0;
705
718
  if (useFractionalSize) {
706
- var baseSize = parseFloat(horizontal ? style.width : style.height);
719
+ var baseSize = parseFloat(horizontal ? style.width : style.height) || 0;
707
720
  var isBorderBoxSizing = style.boxSizing === "border-box";
708
721
  var border = horizontal ? parseFloat(style.borderLeftWidth || "0") + parseFloat(style.borderRightWidth || "0") : parseFloat(style.borderTopWidth || "0") + parseFloat(style.borderBottomWidth || "0");
709
722
  if (isBorderBoxSizing) {
710
- return useOffset ? baseSize : baseSize - border;
723
+ size = useOffset ? baseSize : baseSize - border;
711
724
  } else {
712
725
  var padding = horizontal ? parseFloat(style.paddingLeft || "0") + parseFloat(style.paddingRight || "0") : parseFloat(style.paddingTop || "0") + parseFloat(style.paddingBottom || "0");
713
- return useOffset ? baseSize + padding + border : baseSize + padding;
726
+ size = useOffset ? baseSize + padding + border : baseSize + padding;
714
727
  }
715
728
  } else {
716
729
  var sizeStr = horizontal ? "Width" : "Height";
717
- return useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
730
+ size = useOffset ? el["offset" + sizeStr] : el["client" + sizeStr];
718
731
  }
732
+ return Math.max(size, 0);
719
733
  };
720
734
  var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
721
735
  obj.__proto__ = proto;
@@ -2132,7 +2146,7 @@ version: 4.11.0
2132
2146
  threshold: 1,
2133
2147
  iOSEdgeSwipeThreshold: flicking.iOSEdgeSwipeThreshold,
2134
2148
  preventDefaultOnDrag: flicking.preventDefaultOnDrag,
2135
- scale: flicking.horizontal ? [-1, 0] : [0, -1],
2149
+ scale: flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1],
2136
2150
  releaseOnScroll: true
2137
2151
  });
2138
2152
  var axes = this._axes;
@@ -2357,7 +2371,7 @@ version: 4.11.0
2357
2371
  var panInput = this._panInput;
2358
2372
  axes.disconnect(panInput);
2359
2373
  axes.connect(flicking.horizontal ? [POSITION_KEY, ""] : ["", POSITION_KEY], panInput);
2360
- panInput.options.scale = flicking.horizontal ? [-1, 0] : [0, -1];
2374
+ panInput.options.scale = flicking.horizontal ? [flicking.camera.panelOrder === ORDER.RTL ? 1 : -1, 0] : [0, -1];
2361
2375
  };
2362
2376
  __proto._resetInternalValues = function () {
2363
2377
  this._flicking = null;
@@ -4050,6 +4064,19 @@ version: 4.11.0
4050
4064
  enumerable: false,
4051
4065
  configurable: true
4052
4066
  });
4067
+ Object.defineProperty(__proto, "panelOrder", {
4068
+ /**
4069
+ * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element(`.flicking-camera`)
4070
+ * @ko 카메라 엘리먼트(`.flicking-camera`)에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성
4071
+ * @type {string}
4072
+ * @readonly
4073
+ */
4074
+ get: function () {
4075
+ return this._panelOrder;
4076
+ },
4077
+ enumerable: false,
4078
+ configurable: true
4079
+ });
4053
4080
  Object.defineProperty(__proto, "align", {
4054
4081
  // Options Getter
4055
4082
  /**
@@ -4081,6 +4108,7 @@ version: 4.11.0
4081
4108
  this._el = viewportEl.firstElementChild;
4082
4109
  this._checkTranslateSupport();
4083
4110
  this._updateMode();
4111
+ this.updatePanelOrder();
4084
4112
  return this;
4085
4113
  };
4086
4114
  /**
@@ -4323,6 +4351,24 @@ version: 4.11.0
4323
4351
  this.applyTransform();
4324
4352
  return this;
4325
4353
  };
4354
+ /**
4355
+ * Update direction to match the {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS property applied to the camera element
4356
+ * @ko 카메라 엘리먼트에 적용된 {@link https://developer.mozilla.org/en-US/docs/Web/CSS/direction direction} CSS 속성에 맞게 방향을 업데이트합니다
4357
+ * @return {this}
4358
+ */
4359
+ __proto.updatePanelOrder = function () {
4360
+ var flicking = getFlickingAttached(this._flicking);
4361
+ if (!flicking.horizontal) return this;
4362
+ var el = this._el;
4363
+ var direction = getStyle(el).direction;
4364
+ if (direction !== this._panelOrder) {
4365
+ this._panelOrder = direction === ORDER.RTL ? ORDER.RTL : ORDER.LTR;
4366
+ if (flicking.initialized) {
4367
+ flicking.control.controller.updateDirection();
4368
+ }
4369
+ }
4370
+ return this;
4371
+ };
4326
4372
  /**
4327
4373
  * Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
4328
4374
  * @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
@@ -4347,7 +4393,7 @@ version: 4.11.0
4347
4393
  var renderer = flicking.renderer;
4348
4394
  if (renderer.rendering || !flicking.initialized) return this;
4349
4395
  var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
4350
- el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
4396
+ el.style[this._transform] = flicking.horizontal ? "translate(" + (this._panelOrder === ORDER.RTL ? actualPosition : -actualPosition) + "px)" : "translate(0, " + -actualPosition + "px)";
4351
4397
  return this;
4352
4398
  };
4353
4399
  __proto._resetInternalValues = function () {
@@ -7627,6 +7673,7 @@ version: 4.11.0
7627
7673
  camera.updateRange();
7628
7674
  camera.updateAnchors();
7629
7675
  camera.updateAdaptiveHeight();
7676
+ camera.updatePanelOrder();
7630
7677
  camera.updateOffset();
7631
7678
  return [4 /*yield*/, renderer.render()];
7632
7679
  case 2:
@@ -7867,7 +7914,7 @@ version: 4.11.0
7867
7914
  * Flicking.VERSION; // ex) 4.0.0
7868
7915
  * ```
7869
7916
  */
7870
- Flicking.VERSION = "4.11.0";
7917
+ Flicking.VERSION = "4.11.1";
7871
7918
  return Flicking;
7872
7919
  }(Component);
7873
7920