@egjs/flicking-plugins 4.7.2-beta.0 → 4.7.2-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,6 +4,7 @@ interface AutoPlayOptions {
4
4
  animationDuration: number | undefined;
5
5
  direction: typeof DIRECTION["NEXT"] | typeof DIRECTION["PREV"];
6
6
  stopOnHover: boolean;
7
+ stopOnInit: boolean;
7
8
  delayAfterHover: number;
8
9
  }
9
10
  declare class AutoPlay implements Plugin {
@@ -11,6 +12,7 @@ declare class AutoPlay implements Plugin {
11
12
  private _animationDuration;
12
13
  private _direction;
13
14
  private _stopOnHover;
15
+ private _stopOnInit;
14
16
  private _delayAfterHover;
15
17
  private _flicking;
16
18
  private _timerId;
@@ -20,14 +22,16 @@ declare class AutoPlay implements Plugin {
20
22
  get animationDuration(): number | undefined;
21
23
  get direction(): AutoPlayOptions["direction"];
22
24
  get stopOnHover(): boolean;
25
+ get stopOnInit(): boolean;
23
26
  get delayAfterHover(): number;
24
27
  get playing(): boolean;
25
28
  set duration(val: number);
26
29
  set animationDuration(val: number | undefined);
27
30
  set direction(val: AutoPlayOptions["direction"]);
28
31
  set stopOnHover(val: boolean);
32
+ set stopOnInit(val: boolean);
29
33
  set delayAfterHover(val: number);
30
- constructor({ duration, animationDuration, direction, stopOnHover, delayAfterHover }?: Partial<AutoPlayOptions>);
34
+ constructor({ duration, animationDuration, direction, stopOnHover, stopOnInit, delayAfterHover }?: Partial<AutoPlayOptions>);
31
35
  init(flicking: Flicking): void;
32
36
  destroy(): void;
33
37
  update(): void;
@@ -13,6 +13,7 @@ export interface SychronizableFlickingOptions {
13
13
  }
14
14
  declare class Sync implements Plugin {
15
15
  private _flicking;
16
+ private _disabledIndex;
16
17
  private _type;
17
18
  private _synchronizedFlickingOptions;
18
19
  get type(): SyncOptions["type"];
@@ -4,7 +4,7 @@ name: @egjs/flicking-plugins
4
4
  license: MIT
5
5
  author: NAVER Corp.
6
6
  repository: https://github.com/naver/egjs-flicking-plugins
7
- version: 4.7.2-beta.0
7
+ version: 4.7.2-beta.2
8
8
  */
9
9
  import { EVENTS, MOVE_TYPE, DIRECTION, FlickingError, clamp } from '@egjs/flicking';
10
10
 
@@ -227,6 +227,7 @@ function () {
227
227
  * @param {number | undefined} options.animationDuration Duration of animation of moving to the next panel. If undefined, duration option of the Flicking instance is used instead.<ko>패널이 움직이는 애니메이션의 지속 시간, undefined라면 Flicking 인스턴스의 duration 값을 사용한다</ko>
228
228
  * @param {"PREV" | "NEXT"} options.direction The direction in which the panel moves.<ko>패널이 움직이는 방향</ko>
229
229
  * @param {boolean} options.stopOnHover Whether to stop when mouse hover upon the element.<ko>엘리먼트에 마우스를 올렸을 때 AutoPlay를 정지할지 여부</ko>
230
+ * @param {boolean} options.stopOnInit Whether to stop when the plugin is initialized.<ko>플러그인이 초기화될 때 AutoPlay가 정지 상태일지 여부</ko>
230
231
  * @param {number} options.delayAfterHover If stopOnHover is true, the amount of time to wait before moving on to the next panel when mouse leaves the element.<ko>stopOnHover를 사용한다면 마우스가 엘리먼트로부터 나간 뒤 다음 패널로 움직이기까지 대기 시간</ko>
231
232
  * @example
232
233
  * ```ts
@@ -245,6 +246,8 @@ function () {
245
246
  direction = _e === void 0 ? DIRECTION.NEXT : _e,
246
247
  _f = _b.stopOnHover,
247
248
  stopOnHover = _f === void 0 ? false : _f,
249
+ _g = _b.stopOnInit,
250
+ stopOnInit = _g === void 0 ? false : _g,
248
251
  delayAfterHover = _b.delayAfterHover;
249
252
  /* Internal Values */
250
253
 
@@ -279,6 +282,7 @@ function () {
279
282
  this._animationDuration = animationDuration;
280
283
  this._direction = direction;
281
284
  this._stopOnHover = stopOnHover;
285
+ this._stopOnInit = stopOnInit;
282
286
  this._delayAfterHover = delayAfterHover !== null && delayAfterHover !== void 0 ? delayAfterHover : duration;
283
287
  }
284
288
 
@@ -323,6 +327,16 @@ function () {
323
327
  enumerable: false,
324
328
  configurable: true
325
329
  });
330
+ Object.defineProperty(__proto, "stopOnInit", {
331
+ get: function () {
332
+ return this._stopOnInit;
333
+ },
334
+ set: function (val) {
335
+ this._stopOnInit = val;
336
+ },
337
+ enumerable: false,
338
+ configurable: true
339
+ });
326
340
  Object.defineProperty(__proto, "delayAfterHover", {
327
341
  get: function () {
328
342
  return this._delayAfterHover;
@@ -357,7 +371,9 @@ function () {
357
371
  targetEl.addEventListener("mouseleave", this._onMouseLeave, false);
358
372
  }
359
373
 
360
- this.play();
374
+ if (!this._stopOnInit) {
375
+ this.play();
376
+ }
361
377
  };
362
378
 
363
379
  __proto.destroy = function () {
@@ -825,6 +841,7 @@ function () {
825
841
 
826
842
 
827
843
  this._flicking = null;
844
+ this._disabledIndex = [];
828
845
 
829
846
  this._addEvents = function () {
830
847
  var type = _this._type;
@@ -908,23 +925,24 @@ function () {
908
925
  };
909
926
 
910
927
  this._onMoveStart = function (e) {
911
- _this._synchronizedFlickingOptions.forEach(function (_a) {
928
+ _this._disabledIndex = [];
929
+
930
+ _this._synchronizedFlickingOptions.forEach(function (_a, i) {
912
931
  var flicking = _a.flicking;
913
932
 
914
- if (flicking !== e.currentTarget) {
933
+ if (flicking !== e.currentTarget && flicking.control.controller.enabled) {
934
+ _this._disabledIndex.push(i);
935
+
915
936
  flicking.disableInput();
916
937
  }
917
938
  });
918
939
  };
919
940
 
920
941
  this._onMoveEnd = function (e) {
921
- _this._synchronizedFlickingOptions.forEach(function (_a) {
922
- var flicking = _a.flicking;
923
-
924
- if (flicking !== e.currentTarget) {
925
- flicking.enableInput();
926
- flicking.control.updateInput();
927
- }
942
+ _this._disabledIndex.forEach(function (i) {
943
+ var flicking = _this._synchronizedFlickingOptions[i].flicking;
944
+ flicking.enableInput();
945
+ flicking.control.updateInput();
928
946
  });
929
947
  };
930
948