@egjs/flicking 4.4.2 → 4.6.0
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/TODO.md +3 -0
- package/declaration/Flicking.d.ts +15 -2
- package/declaration/camera/Camera.d.ts +28 -26
- package/declaration/camera/index.d.ts +2 -4
- package/declaration/camera/mode/BoundCameraMode.d.ts +13 -0
- package/declaration/camera/mode/CameraMode.d.ts +19 -0
- package/declaration/camera/mode/CircularCameraMode.d.ts +18 -0
- package/declaration/camera/mode/LinearCameraMode.d.ts +9 -0
- package/declaration/camera/mode/index.d.ts +6 -0
- package/declaration/const/external.d.ts +4 -0
- package/declaration/control/StrictControl.d.ts +1 -0
- package/declaration/core/AutoResizer.d.ts +3 -0
- package/declaration/core/ResizeWatcher.d.ts +33 -0
- package/declaration/renderer/Renderer.d.ts +13 -0
- package/declaration/type/external.d.ts +1 -3
- package/{css → dist/css}/flicking-inline.css +20 -13
- package/dist/css/flicking-inline.min.css +1 -0
- package/dist/css/flicking.css +44 -0
- package/dist/css/flicking.min.css +1 -0
- package/dist/flicking.esm.js +1491 -1251
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +1494 -1253
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +1466 -1225
- package/dist/flicking.pkgd.js.map +1 -1
- package/dist/flicking.pkgd.min.js +2 -2
- package/dist/flicking.pkgd.min.js.map +1 -1
- package/package.json +17 -7
- package/sass/flicking-inline.sass +30 -0
- package/sass/flicking.sass +23 -0
- package/src/Flicking.ts +127 -35
- package/src/camera/Camera.ts +162 -81
- package/src/camera/index.ts +3 -7
- package/src/camera/{BoundCamera.ts → mode/BoundCameraMode.ts} +46 -43
- package/src/camera/mode/CameraMode.ts +77 -0
- package/src/camera/mode/CircularCameraMode.ts +171 -0
- package/src/camera/mode/LinearCameraMode.ts +23 -0
- package/src/camera/mode/index.ts +14 -0
- package/src/cfc/sync.ts +29 -23
- package/src/cfc/withFlickingMethods.ts +3 -2
- package/src/const/external.ts +12 -0
- package/src/control/StrictControl.ts +10 -0
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +92 -43
- package/css/flicking.css +0 -28
- package/declaration/camera/BoundCamera.d.ts +0 -9
- package/declaration/camera/CircularCamera.d.ts +0 -37
- package/declaration/camera/LinearCamera.d.ts +0 -5
- package/dist/flicking-inline.css +0 -2
- package/dist/flicking-inline.css.map +0 -1
- package/dist/flicking.css +0 -2
- package/dist/flicking.css.map +0 -1
- package/src/camera/CircularCamera.ts +0 -268
- package/src/camera/LinearCamera.ts +0 -35
package/dist/flicking.esm.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.
|
|
7
|
+
version: 4.6.0
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -240,10 +240,12 @@ function __read(o, n) {
|
|
|
240
240
|
|
|
241
241
|
return ar;
|
|
242
242
|
}
|
|
243
|
-
|
|
244
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i];
|
|
243
|
+
/** @deprecated */
|
|
245
244
|
|
|
246
|
-
|
|
245
|
+
function __spread() {
|
|
246
|
+
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
247
|
+
|
|
248
|
+
return ar;
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
/*
|
|
@@ -423,6 +425,18 @@ var CLASS = {
|
|
|
423
425
|
HIDDEN: "flicking-hidden",
|
|
424
426
|
DEFAULT_VIRTUAL: "flicking-panel"
|
|
425
427
|
};
|
|
428
|
+
/**
|
|
429
|
+
* An object with all possible {@link Flicking#circularFallback circularFallback}s
|
|
430
|
+
* @ko Flicking의 {@link Flicking#circularFallback circularFallback}에 설정 가능한 값들을 담고 있는 객체
|
|
431
|
+
* @type {object}
|
|
432
|
+
* @property {string} LINEAR "linear"
|
|
433
|
+
* @property {string} BOUND "bound"
|
|
434
|
+
*/
|
|
435
|
+
|
|
436
|
+
var CIRCULAR_FALLBACK = {
|
|
437
|
+
LINEAR: "linear",
|
|
438
|
+
BOUND: "bound"
|
|
439
|
+
};
|
|
426
440
|
|
|
427
441
|
var merge = function (target) {
|
|
428
442
|
var sources = [];
|
|
@@ -606,7 +620,7 @@ var parseElement = function (element) {
|
|
|
606
620
|
if (isString(el)) {
|
|
607
621
|
var tempDiv = document.createElement("div");
|
|
608
622
|
tempDiv.innerHTML = el;
|
|
609
|
-
elements.push.apply(elements,
|
|
623
|
+
elements.push.apply(elements, __spread(toArray(tempDiv.children)));
|
|
610
624
|
|
|
611
625
|
while (tempDiv.firstChild) {
|
|
612
626
|
tempDiv.removeChild(tempDiv.firstChild);
|
|
@@ -955,6 +969,33 @@ function () {
|
|
|
955
969
|
var _this = this;
|
|
956
970
|
|
|
957
971
|
this._onResize = function () {
|
|
972
|
+
var flicking = _this._flicking;
|
|
973
|
+
var resizeDebounce = flicking.resizeDebounce;
|
|
974
|
+
var maxResizeDebounce = flicking.maxResizeDebounce;
|
|
975
|
+
|
|
976
|
+
if (resizeDebounce <= 0) {
|
|
977
|
+
void flicking.resize();
|
|
978
|
+
} else {
|
|
979
|
+
if (_this._maxResizeDebounceTimer <= 0) {
|
|
980
|
+
if (maxResizeDebounce > 0 && maxResizeDebounce >= resizeDebounce) {
|
|
981
|
+
_this._maxResizeDebounceTimer = window.setTimeout(_this._doScheduledResize, maxResizeDebounce);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (_this._resizeTimer > 0) {
|
|
986
|
+
clearTimeout(_this._resizeTimer);
|
|
987
|
+
_this._resizeTimer = 0;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
_this._resizeTimer = window.setTimeout(_this._doScheduledResize, resizeDebounce);
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
this._doScheduledResize = function () {
|
|
995
|
+
clearTimeout(_this._resizeTimer);
|
|
996
|
+
clearTimeout(_this._maxResizeDebounceTimer);
|
|
997
|
+
_this._maxResizeDebounceTimer = -1;
|
|
998
|
+
_this._resizeTimer = -1;
|
|
958
999
|
void _this._flicking.resize();
|
|
959
1000
|
}; // eslint-disable-next-line @typescript-eslint/member-ordering
|
|
960
1001
|
|
|
@@ -974,6 +1015,8 @@ function () {
|
|
|
974
1015
|
this._flicking = flicking;
|
|
975
1016
|
this._enabled = false;
|
|
976
1017
|
this._resizeObserver = null;
|
|
1018
|
+
this._resizeTimer = -1;
|
|
1019
|
+
this._maxResizeDebounceTimer = -1;
|
|
977
1020
|
}
|
|
978
1021
|
|
|
979
1022
|
var __proto = AutoResizer.prototype;
|
|
@@ -2987,9 +3030,8 @@ function (_super) {
|
|
|
2987
3030
|
|
|
2988
3031
|
|
|
2989
3032
|
function SnapControl(_a) {
|
|
2990
|
-
var _b = _a === void 0 ? {} : _a,
|
|
2991
|
-
|
|
2992
|
-
count = _c === void 0 ? Infinity : _c;
|
|
3033
|
+
var _b = (_a === void 0 ? {} : _a).count,
|
|
3034
|
+
count = _b === void 0 ? Infinity : _b;
|
|
2993
3035
|
|
|
2994
3036
|
var _this = _super.call(this) || this;
|
|
2995
3037
|
|
|
@@ -3195,9 +3237,8 @@ function (_super) {
|
|
|
3195
3237
|
|
|
3196
3238
|
|
|
3197
3239
|
function FreeControl(_a) {
|
|
3198
|
-
var _b = _a === void 0 ? {} : _a,
|
|
3199
|
-
|
|
3200
|
-
stopAtEdge = _c === void 0 ? true : _c;
|
|
3240
|
+
var _b = (_a === void 0 ? {} : _a).stopAtEdge,
|
|
3241
|
+
stopAtEdge = _b === void 0 ? true : _b;
|
|
3201
3242
|
|
|
3202
3243
|
var _this = _super.call(this) || this;
|
|
3203
3244
|
|
|
@@ -3331,9 +3372,8 @@ function (_super) {
|
|
|
3331
3372
|
|
|
3332
3373
|
|
|
3333
3374
|
function StrictControl(_a) {
|
|
3334
|
-
var _b = _a === void 0 ? {} : _a,
|
|
3335
|
-
|
|
3336
|
-
count = _c === void 0 ? 1 : _c;
|
|
3375
|
+
var _b = (_a === void 0 ? {} : _a).count,
|
|
3376
|
+
count = _b === void 0 ? 1 : _b;
|
|
3337
3377
|
|
|
3338
3378
|
var _this = _super.call(this) || this;
|
|
3339
3379
|
|
|
@@ -3456,6 +3496,21 @@ function (_super) {
|
|
|
3456
3496
|
};
|
|
3457
3497
|
return this;
|
|
3458
3498
|
};
|
|
3499
|
+
|
|
3500
|
+
__proto.moveToPanel = function (panel, options) {
|
|
3501
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3502
|
+
var flicking, camera, controller;
|
|
3503
|
+
return __generator(this, function (_a) {
|
|
3504
|
+
flicking = getFlickingAttached(this._flicking);
|
|
3505
|
+
camera = flicking.camera;
|
|
3506
|
+
controller = this._controller;
|
|
3507
|
+
controller.update(camera.controlParams);
|
|
3508
|
+
return [2
|
|
3509
|
+
/*return*/
|
|
3510
|
+
, _super.prototype.moveToPanel.call(this, panel, options)];
|
|
3511
|
+
});
|
|
3512
|
+
});
|
|
3513
|
+
};
|
|
3459
3514
|
/**
|
|
3460
3515
|
* Move {@link Camera} to the given position
|
|
3461
3516
|
* @ko {@link Camera}를 주어진 좌표로 이동합니다
|
|
@@ -3565,932 +3620,1012 @@ function (_super) {
|
|
|
3565
3620
|
}(Control);
|
|
3566
3621
|
|
|
3567
3622
|
/**
|
|
3568
|
-
* A
|
|
3569
|
-
* @ko 뷰포트 내에서의 실제 움직임을 담당하는 컴포넌트
|
|
3623
|
+
* A mode of camera
|
|
3570
3624
|
*/
|
|
3571
3625
|
|
|
3572
|
-
var
|
|
3626
|
+
var CameraMode =
|
|
3573
3627
|
/*#__PURE__*/
|
|
3574
3628
|
function () {
|
|
3575
3629
|
/** */
|
|
3576
|
-
function
|
|
3577
|
-
|
|
3630
|
+
function CameraMode(flicking) {
|
|
3631
|
+
this._flicking = flicking;
|
|
3632
|
+
}
|
|
3578
3633
|
|
|
3579
|
-
|
|
3580
|
-
_c = _b.align,
|
|
3581
|
-
align = _c === void 0 ? ALIGN.CENTER : _c;
|
|
3634
|
+
var __proto = CameraMode.prototype;
|
|
3582
3635
|
|
|
3583
|
-
|
|
3584
|
-
|
|
3636
|
+
__proto.getAnchors = function () {
|
|
3637
|
+
var panels = this._flicking.renderer.panels;
|
|
3638
|
+
return panels.map(function (panel, index) {
|
|
3639
|
+
return new AnchorPoint({
|
|
3640
|
+
index: index,
|
|
3641
|
+
position: panel.position,
|
|
3642
|
+
panel: panel
|
|
3643
|
+
});
|
|
3644
|
+
});
|
|
3645
|
+
};
|
|
3585
3646
|
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3647
|
+
__proto.findAnchorIncludePosition = function (position) {
|
|
3648
|
+
var anchors = this._flicking.camera.anchorPoints;
|
|
3649
|
+
var anchorsIncludingPosition = anchors.filter(function (anchor) {
|
|
3650
|
+
return anchor.panel.includePosition(position, true);
|
|
3651
|
+
});
|
|
3652
|
+
return anchorsIncludingPosition.reduce(function (nearest, anchor) {
|
|
3653
|
+
if (!nearest) return anchor;
|
|
3654
|
+
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
3655
|
+
}, null);
|
|
3656
|
+
};
|
|
3589
3657
|
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3658
|
+
__proto.clampToReachablePosition = function (position) {
|
|
3659
|
+
var camera = this._flicking.camera;
|
|
3660
|
+
var range = camera.range;
|
|
3661
|
+
return clamp(position, range.min, range.max);
|
|
3662
|
+
};
|
|
3593
3663
|
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
}
|
|
3598
|
-
} catch (e_1_1) {
|
|
3599
|
-
e_1 = {
|
|
3600
|
-
error: e_1_1
|
|
3601
|
-
};
|
|
3602
|
-
} finally {
|
|
3603
|
-
try {
|
|
3604
|
-
if (transforms_1_1 && !transforms_1_1.done && (_a = transforms_1.return)) _a.call(transforms_1);
|
|
3605
|
-
} finally {
|
|
3606
|
-
if (e_1) throw e_1.error;
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3664
|
+
__proto.getCircularOffset = function () {
|
|
3665
|
+
return 0;
|
|
3666
|
+
};
|
|
3609
3667
|
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3668
|
+
__proto.canReach = function (panel) {
|
|
3669
|
+
var camera = this._flicking.camera;
|
|
3670
|
+
var range = camera.range;
|
|
3671
|
+
if (panel.removed) return false;
|
|
3672
|
+
var panelPos = panel.position;
|
|
3673
|
+
return panelPos >= range.min && panelPos <= range.max;
|
|
3674
|
+
};
|
|
3613
3675
|
|
|
3614
|
-
|
|
3676
|
+
__proto.canSee = function (panel) {
|
|
3677
|
+
var camera = this._flicking.camera;
|
|
3678
|
+
var visibleRange = camera.visibleRange; // Should not include margin, as we don't declare what the margin is visible as what the panel is visible.
|
|
3679
|
+
|
|
3680
|
+
return panel.isVisibleOnRange(visibleRange.min, visibleRange.max);
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3683
|
+
return CameraMode;
|
|
3684
|
+
}();
|
|
3685
|
+
|
|
3686
|
+
var LinearCameraMode =
|
|
3687
|
+
/*#__PURE__*/
|
|
3688
|
+
function (_super) {
|
|
3689
|
+
__extends(LinearCameraMode, _super);
|
|
3690
|
+
|
|
3691
|
+
function LinearCameraMode() {
|
|
3692
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
var __proto = LinearCameraMode.prototype;
|
|
3696
|
+
|
|
3697
|
+
__proto.checkAvailability = function () {
|
|
3698
|
+
// It's always available
|
|
3699
|
+
return true;
|
|
3700
|
+
};
|
|
3701
|
+
|
|
3702
|
+
__proto.getRange = function () {
|
|
3703
|
+
var _a, _b;
|
|
3704
|
+
|
|
3705
|
+
var renderer = this._flicking.renderer;
|
|
3706
|
+
var firstPanel = renderer.getPanel(0);
|
|
3707
|
+
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
3708
|
+
return {
|
|
3709
|
+
min: (_a = firstPanel === null || firstPanel === void 0 ? void 0 : firstPanel.position) !== null && _a !== void 0 ? _a : 0,
|
|
3710
|
+
max: (_b = lastPanel === null || lastPanel === void 0 ? void 0 : lastPanel.position) !== null && _b !== void 0 ? _b : 0
|
|
3615
3711
|
};
|
|
3712
|
+
};
|
|
3616
3713
|
|
|
3617
|
-
|
|
3714
|
+
return LinearCameraMode;
|
|
3715
|
+
}(CameraMode);
|
|
3618
3716
|
|
|
3619
|
-
|
|
3717
|
+
/**
|
|
3718
|
+
* A {@link Camera} mode that connects the last panel and the first panel, enabling continuous loop
|
|
3719
|
+
* @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera} 모드
|
|
3720
|
+
*/
|
|
3620
3721
|
|
|
3722
|
+
var CircularCameraMode =
|
|
3723
|
+
/*#__PURE__*/
|
|
3724
|
+
function (_super) {
|
|
3725
|
+
__extends(CircularCameraMode, _super);
|
|
3621
3726
|
|
|
3622
|
-
|
|
3727
|
+
function CircularCameraMode() {
|
|
3728
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3623
3729
|
}
|
|
3624
3730
|
|
|
3625
|
-
var __proto =
|
|
3626
|
-
Object.defineProperty(__proto, "element", {
|
|
3627
|
-
// Internal states getter
|
|
3731
|
+
var __proto = CircularCameraMode.prototype;
|
|
3628
3732
|
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
* @readonly
|
|
3634
|
-
*/
|
|
3635
|
-
get: function () {
|
|
3636
|
-
return this._el;
|
|
3637
|
-
},
|
|
3638
|
-
enumerable: false,
|
|
3639
|
-
configurable: true
|
|
3640
|
-
});
|
|
3641
|
-
Object.defineProperty(__proto, "children", {
|
|
3642
|
-
/**
|
|
3643
|
-
* An array of the child elements of the camera element(`.flicking-camera`)
|
|
3644
|
-
* @ko 카메라 엘리먼트(`.flicking-camera`)의 자식 엘리먼트 배열
|
|
3645
|
-
* @type {HTMLElement[]}
|
|
3646
|
-
* @readonly
|
|
3647
|
-
*/
|
|
3648
|
-
get: function () {
|
|
3649
|
-
return toArray(this._el.children);
|
|
3650
|
-
},
|
|
3651
|
-
enumerable: false,
|
|
3652
|
-
configurable: true
|
|
3653
|
-
});
|
|
3654
|
-
Object.defineProperty(__proto, "position", {
|
|
3655
|
-
/**
|
|
3656
|
-
* Current position of the camera
|
|
3657
|
-
* @ko Camera의 현재 좌표
|
|
3658
|
-
* @type {number}
|
|
3659
|
-
* @readonly
|
|
3660
|
-
*/
|
|
3661
|
-
get: function () {
|
|
3662
|
-
return this._position;
|
|
3663
|
-
},
|
|
3664
|
-
enumerable: false,
|
|
3665
|
-
configurable: true
|
|
3666
|
-
});
|
|
3667
|
-
Object.defineProperty(__proto, "alignPosition", {
|
|
3668
|
-
/**
|
|
3669
|
-
* Align position inside the viewport where {@link Panel}'s {@link Panel#alignPosition alignPosition} should be located at
|
|
3670
|
-
* @ko 패널의 정렬 기준 위치. 뷰포트 내에서 {@link Panel}의 {@link Panel#alignPosition alignPosition}이 위치해야 하는 곳입니다
|
|
3671
|
-
* @type {number}
|
|
3672
|
-
* @readonly
|
|
3673
|
-
*/
|
|
3674
|
-
get: function () {
|
|
3675
|
-
return this._alignPos;
|
|
3676
|
-
},
|
|
3677
|
-
enumerable: false,
|
|
3678
|
-
configurable: true
|
|
3679
|
-
});
|
|
3680
|
-
Object.defineProperty(__proto, "offset", {
|
|
3681
|
-
/**
|
|
3682
|
-
* Position offset, used for the {@link Flicking#renderOnlyVisible renderOnlyVisible} option
|
|
3683
|
-
* @ko Camera의 좌표 오프셋. {@link Flicking#renderOnlyVisible renderOnlyVisible} 옵션을 위해 사용됩니다.
|
|
3684
|
-
* @type {number}
|
|
3685
|
-
* @default 0
|
|
3686
|
-
* @readonly
|
|
3687
|
-
*/
|
|
3688
|
-
get: function () {
|
|
3689
|
-
return this._offset;
|
|
3690
|
-
},
|
|
3691
|
-
enumerable: false,
|
|
3692
|
-
configurable: true
|
|
3693
|
-
});
|
|
3694
|
-
Object.defineProperty(__proto, "range", {
|
|
3695
|
-
/**
|
|
3696
|
-
* A range that Camera's {@link Camera#position position} can reach
|
|
3697
|
-
* @ko Camera의 {@link Camera#position position}이 도달 가능한 범위
|
|
3698
|
-
* @type {object}
|
|
3699
|
-
* @property {number} min A minimum position<ko>최소 위치</ko>
|
|
3700
|
-
* @property {number} max A maximum position<ko>최대 위치</ko>
|
|
3701
|
-
* @readonly
|
|
3702
|
-
*/
|
|
3703
|
-
get: function () {
|
|
3704
|
-
return this._range;
|
|
3705
|
-
},
|
|
3706
|
-
enumerable: false,
|
|
3707
|
-
configurable: true
|
|
3708
|
-
});
|
|
3709
|
-
Object.defineProperty(__proto, "rangeDiff", {
|
|
3710
|
-
/**
|
|
3711
|
-
* A difference between Camera's minimum and maximum position that can reach
|
|
3712
|
-
* @ko Camera가 도달 가능한 최소/최대 좌표의 차이
|
|
3713
|
-
* @type {number}
|
|
3714
|
-
* @readonly
|
|
3715
|
-
*/
|
|
3716
|
-
get: function () {
|
|
3717
|
-
return this._range.max - this._range.min;
|
|
3718
|
-
},
|
|
3719
|
-
enumerable: false,
|
|
3720
|
-
configurable: true
|
|
3721
|
-
});
|
|
3722
|
-
Object.defineProperty(__proto, "visiblePanels", {
|
|
3723
|
-
/**
|
|
3724
|
-
* An array of visible panels from the current position
|
|
3725
|
-
* @ko 현재 보이는 패널들의 배열
|
|
3726
|
-
* @type {Panel[]}
|
|
3727
|
-
* @readonly
|
|
3728
|
-
*/
|
|
3729
|
-
get: function () {
|
|
3730
|
-
return this._visiblePanels;
|
|
3731
|
-
},
|
|
3732
|
-
enumerable: false,
|
|
3733
|
-
configurable: true
|
|
3734
|
-
});
|
|
3735
|
-
Object.defineProperty(__proto, "visibleRange", {
|
|
3736
|
-
/**
|
|
3737
|
-
* A range of the visible area from the current position
|
|
3738
|
-
* @ko 현재 위치에서 보이는 범위
|
|
3739
|
-
* @type {object}
|
|
3740
|
-
* @property {number} min A minimum position<ko>최소 위치</ko>
|
|
3741
|
-
* @property {number} min A maximum position<ko>최대 위치</ko>
|
|
3742
|
-
* @readonly
|
|
3743
|
-
*/
|
|
3744
|
-
get: function () {
|
|
3745
|
-
return {
|
|
3746
|
-
min: this._position - this._alignPos,
|
|
3747
|
-
max: this._position - this._alignPos + this.size
|
|
3748
|
-
};
|
|
3749
|
-
},
|
|
3750
|
-
enumerable: false,
|
|
3751
|
-
configurable: true
|
|
3752
|
-
});
|
|
3753
|
-
Object.defineProperty(__proto, "anchorPoints", {
|
|
3754
|
-
/**
|
|
3755
|
-
* An array of {@link AnchorPoint}s that Camera can be stopped at
|
|
3756
|
-
* @ko 카메라가 도달 가능한 {@link AnchorPoint}의 목록
|
|
3757
|
-
* @type {AnchorPoint[]}
|
|
3758
|
-
* @readonly
|
|
3759
|
-
*/
|
|
3760
|
-
get: function () {
|
|
3761
|
-
return this._anchors;
|
|
3762
|
-
},
|
|
3763
|
-
enumerable: false,
|
|
3764
|
-
configurable: true
|
|
3765
|
-
});
|
|
3766
|
-
Object.defineProperty(__proto, "controlParams", {
|
|
3767
|
-
/**
|
|
3768
|
-
* A current parameters of the Camera for updating {@link AxesController}
|
|
3769
|
-
* @ko {@link AxesController}를 업데이트하기 위한 현재 Camera 패러미터들
|
|
3770
|
-
* @type {ControlParams}
|
|
3771
|
-
* @readonly
|
|
3772
|
-
*/
|
|
3773
|
-
get: function () {
|
|
3774
|
-
return {
|
|
3775
|
-
range: this._range,
|
|
3776
|
-
position: this._position,
|
|
3777
|
-
circular: false
|
|
3778
|
-
};
|
|
3779
|
-
},
|
|
3780
|
-
enumerable: false,
|
|
3781
|
-
configurable: true
|
|
3782
|
-
});
|
|
3783
|
-
Object.defineProperty(__proto, "atEdge", {
|
|
3784
|
-
/**
|
|
3785
|
-
* A Boolean value indicating whether Camera's over the minimum or maximum position reachable
|
|
3786
|
-
* @ko 현재 카메라가 도달 가능한 범위의 최소 혹은 최대점을 넘어섰는지를 나타냅니다
|
|
3787
|
-
* @type {boolean}
|
|
3788
|
-
* @readonly
|
|
3789
|
-
*/
|
|
3790
|
-
get: function () {
|
|
3791
|
-
return this._position <= this._range.min || this._position >= this._range.max;
|
|
3792
|
-
},
|
|
3793
|
-
enumerable: false,
|
|
3794
|
-
configurable: true
|
|
3795
|
-
});
|
|
3796
|
-
Object.defineProperty(__proto, "size", {
|
|
3797
|
-
/**
|
|
3798
|
-
* Return the size of the viewport
|
|
3799
|
-
* @ko 뷰포트 크기를 반환합니다
|
|
3800
|
-
* @type {number}
|
|
3801
|
-
* @readonly
|
|
3802
|
-
*/
|
|
3803
|
-
get: function () {
|
|
3804
|
-
var flicking = this._flicking;
|
|
3805
|
-
return flicking ? flicking.horizontal ? flicking.viewport.width : flicking.viewport.height : 0;
|
|
3806
|
-
},
|
|
3807
|
-
enumerable: false,
|
|
3808
|
-
configurable: true
|
|
3809
|
-
});
|
|
3810
|
-
Object.defineProperty(__proto, "progress", {
|
|
3811
|
-
/**
|
|
3812
|
-
* Return the camera's position progress from the first panel to last panel
|
|
3813
|
-
* Range is from 0 to last panel's index
|
|
3814
|
-
* @ko 첫번째 패널로부터 마지막 패널까지의 카메라 위치의 진행도를 반환합니다
|
|
3815
|
-
* 범위는 0부터 마지막 패널의 인덱스까지입니다
|
|
3816
|
-
* @type {number}
|
|
3817
|
-
* @readonly
|
|
3818
|
-
*/
|
|
3819
|
-
get: function () {
|
|
3820
|
-
var flicking = this._flicking;
|
|
3821
|
-
var position = this._position + this._offset;
|
|
3822
|
-
var nearestAnchor = this.findNearestAnchor(this._position);
|
|
3733
|
+
__proto.checkAvailability = function () {
|
|
3734
|
+
var flicking = this._flicking;
|
|
3735
|
+
var renderer = flicking.renderer;
|
|
3736
|
+
var panels = renderer.panels;
|
|
3823
3737
|
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3738
|
+
if (panels.length <= 0) {
|
|
3739
|
+
return false;
|
|
3740
|
+
}
|
|
3827
3741
|
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3742
|
+
var firstPanel = panels[0];
|
|
3743
|
+
var lastPanel = panels[panels.length - 1];
|
|
3744
|
+
var firstPanelPrev = firstPanel.range.min - firstPanel.margin.prev;
|
|
3745
|
+
var lastPanelNext = lastPanel.range.max + lastPanel.margin.next;
|
|
3746
|
+
var visibleSize = flicking.camera.size;
|
|
3747
|
+
var panelSizeSum = lastPanelNext - firstPanelPrev;
|
|
3748
|
+
var canSetCircularMode = panels.every(function (panel) {
|
|
3749
|
+
return panelSizeSum - panel.size >= visibleSize;
|
|
3750
|
+
});
|
|
3751
|
+
return canSetCircularMode;
|
|
3752
|
+
};
|
|
3835
3753
|
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3754
|
+
__proto.getRange = function () {
|
|
3755
|
+
var flicking = this._flicking;
|
|
3756
|
+
var panels = flicking.renderer.panels;
|
|
3839
3757
|
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3758
|
+
if (panels.length <= 0) {
|
|
3759
|
+
return {
|
|
3760
|
+
min: 0,
|
|
3761
|
+
max: 0
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3843
3764
|
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3765
|
+
var firstPanel = panels[0];
|
|
3766
|
+
var lastPanel = panels[panels.length - 1];
|
|
3767
|
+
var firstPanelPrev = firstPanel.range.min - firstPanel.margin.prev;
|
|
3768
|
+
var lastPanelNext = lastPanel.range.max + lastPanel.margin.next;
|
|
3769
|
+
return {
|
|
3770
|
+
min: firstPanelPrev,
|
|
3771
|
+
max: lastPanelNext
|
|
3772
|
+
};
|
|
3773
|
+
};
|
|
3847
3774
|
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3775
|
+
__proto.getAnchors = function () {
|
|
3776
|
+
var flicking = this._flicking;
|
|
3777
|
+
var panels = flicking.renderer.panels;
|
|
3778
|
+
return panels.map(function (panel, index) {
|
|
3779
|
+
return new AnchorPoint({
|
|
3780
|
+
index: index,
|
|
3781
|
+
position: panel.position,
|
|
3782
|
+
panel: panel
|
|
3783
|
+
});
|
|
3784
|
+
});
|
|
3785
|
+
};
|
|
3852
3786
|
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3787
|
+
__proto.findAnchorIncludePosition = function (position) {
|
|
3788
|
+
var camera = this._flicking.camera;
|
|
3789
|
+
var range = camera.range;
|
|
3790
|
+
var anchors = camera.anchorPoints;
|
|
3791
|
+
var rangeDiff = camera.rangeDiff;
|
|
3792
|
+
var anchorCount = anchors.length;
|
|
3793
|
+
var positionInRange = circulatePosition(position, range.min, range.max);
|
|
3856
3794
|
|
|
3857
|
-
|
|
3858
|
-
}
|
|
3859
|
-
},
|
|
3860
|
-
enumerable: false,
|
|
3861
|
-
configurable: true
|
|
3862
|
-
});
|
|
3863
|
-
Object.defineProperty(__proto, "align", {
|
|
3864
|
-
// Options Getter
|
|
3795
|
+
var anchorInRange = _super.prototype.findAnchorIncludePosition.call(this, positionInRange);
|
|
3865
3796
|
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
* @ko Camera를 초기화합니다
|
|
3884
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
3885
|
-
* @chainable
|
|
3886
|
-
* @throws {FlickingError}
|
|
3887
|
-
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
3888
|
-
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
3889
|
-
* @return {this}
|
|
3890
|
-
*/
|
|
3797
|
+
if (anchorCount > 0 && (position === range.min || position === range.max)) {
|
|
3798
|
+
var possibleAnchors = [anchorInRange, new AnchorPoint({
|
|
3799
|
+
index: 0,
|
|
3800
|
+
position: anchors[0].position + rangeDiff,
|
|
3801
|
+
panel: anchors[0].panel
|
|
3802
|
+
}), new AnchorPoint({
|
|
3803
|
+
index: anchorCount - 1,
|
|
3804
|
+
position: anchors[anchorCount - 1].position - rangeDiff,
|
|
3805
|
+
panel: anchors[anchorCount - 1].panel
|
|
3806
|
+
})].filter(function (anchor) {
|
|
3807
|
+
return !!anchor;
|
|
3808
|
+
});
|
|
3809
|
+
anchorInRange = possibleAnchors.reduce(function (nearest, anchor) {
|
|
3810
|
+
if (!nearest) return anchor;
|
|
3811
|
+
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
3812
|
+
}, null);
|
|
3813
|
+
}
|
|
3891
3814
|
|
|
3892
|
-
|
|
3893
|
-
this._flicking = flicking;
|
|
3894
|
-
var viewportEl = flicking.viewport.element;
|
|
3895
|
-
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
3896
|
-
this._el = viewportEl.firstElementChild;
|
|
3815
|
+
if (!anchorInRange) return null;
|
|
3897
3816
|
|
|
3898
|
-
|
|
3817
|
+
if (position < range.min) {
|
|
3818
|
+
var loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
|
|
3819
|
+
return new AnchorPoint({
|
|
3820
|
+
index: anchorInRange.index,
|
|
3821
|
+
position: anchorInRange.position + rangeDiff * loopCount,
|
|
3822
|
+
panel: anchorInRange.panel
|
|
3823
|
+
});
|
|
3824
|
+
} else if (position > range.max) {
|
|
3825
|
+
var loopCount = Math.floor((position - range.max) / rangeDiff) + 1;
|
|
3826
|
+
return new AnchorPoint({
|
|
3827
|
+
index: anchorInRange.index,
|
|
3828
|
+
position: anchorInRange.position + rangeDiff * loopCount,
|
|
3829
|
+
panel: anchorInRange.panel
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3899
3832
|
|
|
3900
|
-
return
|
|
3833
|
+
return anchorInRange;
|
|
3901
3834
|
};
|
|
3902
|
-
/**
|
|
3903
|
-
* Destroy Camera and return to initial state
|
|
3904
|
-
* @ko Camera를 초기 상태로 되돌립니다
|
|
3905
|
-
* @return {void}
|
|
3906
|
-
*/
|
|
3907
3835
|
|
|
3836
|
+
__proto.getCircularOffset = function () {
|
|
3837
|
+
var flicking = this._flicking;
|
|
3838
|
+
var camera = flicking.camera;
|
|
3839
|
+
if (!camera.circularEnabled) return 0;
|
|
3840
|
+
var toggled = flicking.panels.filter(function (panel) {
|
|
3841
|
+
return panel.toggled;
|
|
3842
|
+
});
|
|
3843
|
+
var toggledPrev = toggled.filter(function (panel) {
|
|
3844
|
+
return panel.toggleDirection === DIRECTION.PREV;
|
|
3845
|
+
});
|
|
3846
|
+
var toggledNext = toggled.filter(function (panel) {
|
|
3847
|
+
return panel.toggleDirection === DIRECTION.NEXT;
|
|
3848
|
+
});
|
|
3849
|
+
return this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
|
|
3850
|
+
};
|
|
3908
3851
|
|
|
3909
|
-
__proto.
|
|
3910
|
-
|
|
3852
|
+
__proto.clampToReachablePosition = function (position) {
|
|
3853
|
+
// Basically all position is reachable for circular camera
|
|
3854
|
+
return position;
|
|
3855
|
+
};
|
|
3911
3856
|
|
|
3912
|
-
|
|
3857
|
+
__proto.canReach = function (panel) {
|
|
3858
|
+
if (panel.removed) return false; // Always reachable on circular mode
|
|
3913
3859
|
|
|
3914
|
-
return
|
|
3860
|
+
return true;
|
|
3915
3861
|
};
|
|
3916
|
-
/**
|
|
3917
|
-
* Move to the given position and apply CSS transform
|
|
3918
|
-
* @ko 해당 좌표로 이동하고, CSS transform을 적용합니다
|
|
3919
|
-
* @param {number} pos A new position<ko>움직일 위치</ko>
|
|
3920
|
-
* @throws {FlickingError}
|
|
3921
|
-
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
3922
|
-
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
3923
|
-
* @return {this}
|
|
3924
|
-
*/
|
|
3925
3862
|
|
|
3863
|
+
__proto.canSee = function (panel) {
|
|
3864
|
+
var camera = this._flicking.camera;
|
|
3865
|
+
var range = camera.range;
|
|
3866
|
+
var rangeDiff = camera.rangeDiff;
|
|
3867
|
+
var visibleRange = camera.visibleRange;
|
|
3926
3868
|
|
|
3927
|
-
|
|
3928
|
-
var prevPos = this._position;
|
|
3929
|
-
this._position = pos;
|
|
3869
|
+
var visibleInCurrentRange = _super.prototype.canSee.call(this, panel); // Check looped visible area for circular case
|
|
3930
3870
|
|
|
3931
|
-
this._refreshVisiblePanels();
|
|
3932
3871
|
|
|
3933
|
-
|
|
3872
|
+
if (visibleRange.min < range.min) {
|
|
3873
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
|
|
3874
|
+
} else if (visibleRange.max > range.max) {
|
|
3875
|
+
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
|
|
3876
|
+
}
|
|
3934
3877
|
|
|
3935
|
-
|
|
3878
|
+
return visibleInCurrentRange;
|
|
3879
|
+
};
|
|
3936
3880
|
|
|
3937
|
-
|
|
3881
|
+
__proto._calcPanelAreaSum = function (panels) {
|
|
3882
|
+
return panels.reduce(function (sum, panel) {
|
|
3883
|
+
return sum + panel.sizeIncludingMargin;
|
|
3884
|
+
}, 0);
|
|
3938
3885
|
};
|
|
3939
|
-
/**
|
|
3940
|
-
* Return a previous {@link AnchorPoint} of given {@link AnchorPoint}
|
|
3941
|
-
* If it does not exist, return `null` instead
|
|
3942
|
-
* @ko 주어진 {@link AnchorPoint}의 이전 {@link AnchorPoint}를 반환합니다
|
|
3943
|
-
* 존재하지 않을 경우 `null`을 반환합니다
|
|
3944
|
-
* @param {AnchorPoint} anchor A reference {@link AnchorPoint}<ko>기준 {@link AnchorPoint}</ko>
|
|
3945
|
-
* @return {AnchorPoint | null} The previous {@link AnchorPoint}<ko>이전 {@link AnchorPoint}</ko>
|
|
3946
|
-
*/
|
|
3947
3886
|
|
|
3887
|
+
return CircularCameraMode;
|
|
3888
|
+
}(CameraMode);
|
|
3948
3889
|
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
* Return a next {@link AnchorPoint} of given {@link AnchorPoint}
|
|
3954
|
-
* If it does not exist, return `null` instead
|
|
3955
|
-
* @ko 주어진 {@link AnchorPoint}의 다음 {@link AnchorPoint}를 반환합니다
|
|
3956
|
-
* 존재하지 않을 경우 `null`을 반환합니다
|
|
3957
|
-
* @param {AnchorPoint} anchor A reference {@link AnchorPoint}<ko>기준 {@link AnchorPoint}</ko>
|
|
3958
|
-
* @return {AnchorPoint | null} The next {@link AnchorPoint}<ko>다음 {@link AnchorPoint}</ko>
|
|
3959
|
-
*/
|
|
3890
|
+
var BoundCameraMode =
|
|
3891
|
+
/*#__PURE__*/
|
|
3892
|
+
function (_super) {
|
|
3893
|
+
__extends(BoundCameraMode, _super);
|
|
3960
3894
|
|
|
3895
|
+
function BoundCameraMode() {
|
|
3896
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3897
|
+
}
|
|
3961
3898
|
|
|
3962
|
-
__proto
|
|
3963
|
-
|
|
3899
|
+
var __proto = BoundCameraMode.prototype;
|
|
3900
|
+
|
|
3901
|
+
__proto.checkAvailability = function () {
|
|
3902
|
+
var flicking = this._flicking;
|
|
3903
|
+
var renderer = flicking.renderer;
|
|
3904
|
+
var firstPanel = renderer.getPanel(0);
|
|
3905
|
+
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
3906
|
+
|
|
3907
|
+
if (!firstPanel || !lastPanel) {
|
|
3908
|
+
return false;
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3911
|
+
var viewportSize = flicking.camera.size;
|
|
3912
|
+
var firstPanelPrev = firstPanel.range.min;
|
|
3913
|
+
var lastPanelNext = lastPanel.range.max;
|
|
3914
|
+
var panelAreaSize = lastPanelNext - firstPanelPrev;
|
|
3915
|
+
var isBiggerThanViewport = viewportSize < panelAreaSize;
|
|
3916
|
+
return isBiggerThanViewport;
|
|
3964
3917
|
};
|
|
3965
|
-
/**
|
|
3966
|
-
* Return the camera's position progress in the panel below
|
|
3967
|
-
* Value is from 0 to 1 when the camera's inside panel
|
|
3968
|
-
* Value can be lower than 0 or bigger than 1 when it's in the margin area
|
|
3969
|
-
* @ko 현재 카메라 아래 패널에서의 위치 진행도를 반환합니다
|
|
3970
|
-
* 반환값은 카메라가 패널 내부에 있을 경우 0부터 1까지의 값을 갖습니다
|
|
3971
|
-
* 패널의 margin 영역에 있을 경우 0보다 작거나 1보다 큰 값을 반환할 수 있습니다
|
|
3972
|
-
*/
|
|
3973
3918
|
|
|
3919
|
+
__proto.getRange = function () {
|
|
3920
|
+
var flicking = this._flicking;
|
|
3921
|
+
var renderer = flicking.renderer;
|
|
3922
|
+
var alignPos = flicking.camera.alignPosition;
|
|
3923
|
+
var firstPanel = renderer.getPanel(0);
|
|
3924
|
+
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
3925
|
+
|
|
3926
|
+
if (!firstPanel || !lastPanel) {
|
|
3927
|
+
return {
|
|
3928
|
+
min: 0,
|
|
3929
|
+
max: 0
|
|
3930
|
+
};
|
|
3931
|
+
}
|
|
3974
3932
|
|
|
3975
|
-
|
|
3976
|
-
var
|
|
3977
|
-
|
|
3933
|
+
var viewportSize = flicking.camera.size;
|
|
3934
|
+
var firstPanelPrev = firstPanel.range.min;
|
|
3935
|
+
var lastPanelNext = lastPanel.range.max;
|
|
3936
|
+
var panelAreaSize = lastPanelNext - firstPanelPrev;
|
|
3937
|
+
var isBiggerThanViewport = viewportSize < panelAreaSize;
|
|
3938
|
+
var firstPos = firstPanelPrev + alignPos;
|
|
3939
|
+
var lastPos = lastPanelNext - viewportSize + alignPos;
|
|
3940
|
+
|
|
3941
|
+
if (isBiggerThanViewport) {
|
|
3942
|
+
return {
|
|
3943
|
+
min: firstPos,
|
|
3944
|
+
max: lastPos
|
|
3945
|
+
};
|
|
3946
|
+
} else {
|
|
3947
|
+
var align = flicking.camera.align;
|
|
3948
|
+
var alignVal = typeof align === "object" ? align.camera : align;
|
|
3949
|
+
var pos = firstPos + parseAlign$1(alignVal, lastPos - firstPos);
|
|
3950
|
+
return {
|
|
3951
|
+
min: pos,
|
|
3952
|
+
max: pos
|
|
3953
|
+
};
|
|
3954
|
+
}
|
|
3978
3955
|
};
|
|
3979
|
-
/**
|
|
3980
|
-
* Return {@link AnchorPoint} that includes given position
|
|
3981
|
-
* If there's no {@link AnchorPoint} that includes the given position, return `null` instead
|
|
3982
|
-
* @ko 주어진 좌표를 포함하는 {@link AnchorPoint}를 반환합니다
|
|
3983
|
-
* 주어진 좌표를 포함하는 {@link AnchorPoint}가 없을 경우 `null`을 반환합니다
|
|
3984
|
-
* @param {number} position A position to check<ko>확인할 좌표</ko>
|
|
3985
|
-
* @return {AnchorPoint | null} The {@link AnchorPoint} that includes the given position<ko>해당 좌표를 포함하는 {@link AnchorPoint}</ko>
|
|
3986
|
-
*/
|
|
3987
3956
|
|
|
3957
|
+
__proto.getAnchors = function () {
|
|
3958
|
+
var flicking = this._flicking;
|
|
3959
|
+
var camera = flicking.camera;
|
|
3960
|
+
var panels = flicking.renderer.panels;
|
|
3988
3961
|
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3962
|
+
if (panels.length <= 0) {
|
|
3963
|
+
return [];
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3966
|
+
var range = flicking.camera.range;
|
|
3967
|
+
var reachablePanels = panels.filter(function (panel) {
|
|
3968
|
+
return camera.canReach(panel);
|
|
3993
3969
|
});
|
|
3994
|
-
return anchorsIncludingPosition.reduce(function (nearest, anchor) {
|
|
3995
|
-
if (!nearest) return anchor;
|
|
3996
|
-
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
3997
|
-
}, null);
|
|
3998
|
-
};
|
|
3999
|
-
/**
|
|
4000
|
-
* Return {@link AnchorPoint} nearest to given position
|
|
4001
|
-
* If there're no {@link AnchorPoint}s, return `null` instead
|
|
4002
|
-
* @ko 해당 좌표에서 가장 가까운 {@link AnchorPoint}를 반환합니다
|
|
4003
|
-
* {@link AnchorPoint}가 하나도 없을 경우 `null`을 반환합니다
|
|
4004
|
-
* @param {number} position A position to check<ko>확인할 좌표</ko>
|
|
4005
|
-
* @return {AnchorPoint | null} The {@link AnchorPoint} nearest to the given position<ko>해당 좌표에 가장 인접한 {@link AnchorPoint}</ko>
|
|
4006
|
-
*/
|
|
4007
3970
|
|
|
3971
|
+
if (reachablePanels.length > 0) {
|
|
3972
|
+
var shouldPrependBoundAnchor = reachablePanels[0].position !== range.min;
|
|
3973
|
+
var shouldAppendBoundAnchor = reachablePanels[reachablePanels.length - 1].position !== range.max;
|
|
3974
|
+
var indexOffset_1 = shouldPrependBoundAnchor ? 1 : 0;
|
|
3975
|
+
var newAnchors = reachablePanels.map(function (panel, idx) {
|
|
3976
|
+
return new AnchorPoint({
|
|
3977
|
+
index: idx + indexOffset_1,
|
|
3978
|
+
position: panel.position,
|
|
3979
|
+
panel: panel
|
|
3980
|
+
});
|
|
3981
|
+
});
|
|
4008
3982
|
|
|
4009
|
-
|
|
4010
|
-
|
|
3983
|
+
if (shouldPrependBoundAnchor) {
|
|
3984
|
+
newAnchors.splice(0, 0, new AnchorPoint({
|
|
3985
|
+
index: 0,
|
|
3986
|
+
position: range.min,
|
|
3987
|
+
panel: panels[reachablePanels[0].index - 1]
|
|
3988
|
+
}));
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
if (shouldAppendBoundAnchor) {
|
|
3992
|
+
newAnchors.push(new AnchorPoint({
|
|
3993
|
+
index: newAnchors.length,
|
|
3994
|
+
position: range.max,
|
|
3995
|
+
panel: panels[reachablePanels[reachablePanels.length - 1].index + 1]
|
|
3996
|
+
}));
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3999
|
+
return newAnchors;
|
|
4000
|
+
} else if (range.min !== range.max) {
|
|
4001
|
+
// There're more than 2 panels
|
|
4002
|
+
var nearestPanelAtMin = this._findNearestPanel(range.min, panels);
|
|
4003
|
+
|
|
4004
|
+
var panelAtMin = nearestPanelAtMin.index === panels.length - 1 ? nearestPanelAtMin.prev() : nearestPanelAtMin;
|
|
4005
|
+
var panelAtMax = panelAtMin.next();
|
|
4006
|
+
return [new AnchorPoint({
|
|
4007
|
+
index: 0,
|
|
4008
|
+
position: range.min,
|
|
4009
|
+
panel: panelAtMin
|
|
4010
|
+
}), new AnchorPoint({
|
|
4011
|
+
index: 1,
|
|
4012
|
+
position: range.max,
|
|
4013
|
+
panel: panelAtMax
|
|
4014
|
+
})];
|
|
4015
|
+
} else {
|
|
4016
|
+
return [new AnchorPoint({
|
|
4017
|
+
index: 0,
|
|
4018
|
+
position: range.min,
|
|
4019
|
+
panel: this._findNearestPanel(range.min, panels)
|
|
4020
|
+
})];
|
|
4021
|
+
}
|
|
4022
|
+
};
|
|
4023
|
+
|
|
4024
|
+
__proto.findAnchorIncludePosition = function (position) {
|
|
4025
|
+
var camera = this._flicking.camera;
|
|
4026
|
+
var range = camera.range;
|
|
4027
|
+
var anchors = camera.anchorPoints;
|
|
4011
4028
|
if (anchors.length <= 0) return null;
|
|
4029
|
+
|
|
4030
|
+
if (position <= range.min) {
|
|
4031
|
+
return anchors[0];
|
|
4032
|
+
} else if (position >= range.max) {
|
|
4033
|
+
return anchors[anchors.length - 1];
|
|
4034
|
+
} else {
|
|
4035
|
+
return _super.prototype.findAnchorIncludePosition.call(this, position);
|
|
4036
|
+
}
|
|
4037
|
+
};
|
|
4038
|
+
|
|
4039
|
+
__proto._findNearestPanel = function (pos, panels) {
|
|
4012
4040
|
var prevDist = Infinity;
|
|
4013
4041
|
|
|
4014
|
-
for (var
|
|
4015
|
-
var
|
|
4016
|
-
var dist = Math.abs(
|
|
4042
|
+
for (var panelIdx = 0; panelIdx < panels.length; panelIdx++) {
|
|
4043
|
+
var panel = panels[panelIdx];
|
|
4044
|
+
var dist = Math.abs(panel.position - pos);
|
|
4017
4045
|
|
|
4018
4046
|
if (dist > prevDist) {
|
|
4019
4047
|
// Return previous anchor
|
|
4020
|
-
return
|
|
4048
|
+
return panels[panelIdx - 1];
|
|
4021
4049
|
}
|
|
4022
4050
|
|
|
4023
4051
|
prevDist = dist;
|
|
4024
4052
|
} // Return last anchor
|
|
4025
4053
|
|
|
4026
4054
|
|
|
4027
|
-
return
|
|
4028
|
-
};
|
|
4029
|
-
/**
|
|
4030
|
-
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
4031
|
-
* @ko 현재 {@link Flicking#currentPanel}에 해당하는 {@link AnchorPoint}를 반환합니다
|
|
4032
|
-
* @return {AnchorPoint | null}
|
|
4033
|
-
*/
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
__proto.findActiveAnchor = function () {
|
|
4037
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4038
|
-
var activeIndex = flicking.control.activeIndex;
|
|
4039
|
-
return find(this._anchors, function (anchor) {
|
|
4040
|
-
return anchor.panel.index === activeIndex;
|
|
4041
|
-
});
|
|
4055
|
+
return panels[panels.length - 1];
|
|
4042
4056
|
};
|
|
4043
|
-
/**
|
|
4044
|
-
* Clamp the given position between camera's range
|
|
4045
|
-
* @ko 주어진 좌표를 Camera가 도달 가능한 범위 사이의 값으로 만듭니다
|
|
4046
|
-
* @param {number} position A position to clamp<ko>범위를 제한할 좌표</ko>
|
|
4047
|
-
* @return {number} A clamped position<ko>범위 제한된 좌표</ko>
|
|
4048
|
-
*/
|
|
4049
4057
|
|
|
4058
|
+
return BoundCameraMode;
|
|
4059
|
+
}(CameraMode);
|
|
4050
4060
|
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
/**
|
|
4056
|
-
* Check whether the given panel is inside of the Camera's range
|
|
4057
|
-
* @ko 해당 {@link Panel}이 Camera가 도달 가능한 범위 내에 있는지를 반환합니다
|
|
4058
|
-
* @param panel An instance of {@link Panel} to check<ko>확인할 {@link Panel}의 인스턴스</ko>
|
|
4059
|
-
* @return {boolean} Whether the panel's inside Camera's range<ko>도달 가능한 범위 내에 해당 패널이 존재하는지 여부</ko>
|
|
4060
|
-
*/
|
|
4061
|
-
|
|
4061
|
+
/**
|
|
4062
|
+
* A component that manages actual movement inside the viewport
|
|
4063
|
+
* @ko 뷰포트 내에서의 실제 움직임을 담당하는 컴포넌트
|
|
4064
|
+
*/
|
|
4062
4065
|
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
/**
|
|
4070
|
-
* Check whether the given panel element is visible at the current position
|
|
4071
|
-
* @ko 현재 좌표에서 해당 패널 엘리먼트를 볼 수 있는지 여부를 반환합니다
|
|
4072
|
-
* @param panel An instance of {@link Panel} to check<ko>확인할 {@link Panel}의 인스턴스</ko>
|
|
4073
|
-
* @return Whether the panel element is visible at the current position<ko>현재 위치에서 해당 패널 엘리먼트가 보이는지 여부</ko>
|
|
4074
|
-
*/
|
|
4066
|
+
var Camera =
|
|
4067
|
+
/*#__PURE__*/
|
|
4068
|
+
function () {
|
|
4069
|
+
/** */
|
|
4070
|
+
function Camera(flicking, _a) {
|
|
4071
|
+
var _this = this;
|
|
4075
4072
|
|
|
4073
|
+
var _b = (_a === void 0 ? {} : _a).align,
|
|
4074
|
+
align = _b === void 0 ? ALIGN.CENTER : _b;
|
|
4076
4075
|
|
|
4077
|
-
|
|
4078
|
-
|
|
4076
|
+
this._checkTranslateSupport = function () {
|
|
4077
|
+
var e_1, _a;
|
|
4079
4078
|
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
* Update Camera's {@link Camera#alignPosition alignPosition}
|
|
4084
|
-
* @ko Camera의 {@link Camera#alignPosition alignPosition}을 업데이트합니다
|
|
4085
|
-
* @chainable
|
|
4086
|
-
* @return {this}
|
|
4087
|
-
*/
|
|
4079
|
+
var transforms = ["webkitTransform", "msTransform", "MozTransform", "OTransform", "transform"];
|
|
4080
|
+
var supportedStyle = document.documentElement.style;
|
|
4081
|
+
var transformName = "";
|
|
4088
4082
|
|
|
4083
|
+
try {
|
|
4084
|
+
for (var transforms_1 = __values(transforms), transforms_1_1 = transforms_1.next(); !transforms_1_1.done; transforms_1_1 = transforms_1.next()) {
|
|
4085
|
+
var prefixedTransform = transforms_1_1.value;
|
|
4089
4086
|
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4087
|
+
if (prefixedTransform in supportedStyle) {
|
|
4088
|
+
transformName = prefixedTransform;
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
} catch (e_1_1) {
|
|
4092
|
+
e_1 = {
|
|
4093
|
+
error: e_1_1
|
|
4094
|
+
};
|
|
4095
|
+
} finally {
|
|
4096
|
+
try {
|
|
4097
|
+
if (transforms_1_1 && !transforms_1_1.done && (_a = transforms_1.return)) _a.call(transforms_1);
|
|
4098
|
+
} finally {
|
|
4099
|
+
if (e_1) throw e_1.error;
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
if (!transformName) {
|
|
4104
|
+
throw new FlickingError(MESSAGE.TRANSFORM_NOT_SUPPORTED, CODE.TRANSFORM_NOT_SUPPORTED);
|
|
4105
|
+
}
|
|
4106
|
+
|
|
4107
|
+
_this._transform = transformName;
|
|
4108
|
+
};
|
|
4109
|
+
|
|
4110
|
+
this._flicking = flicking;
|
|
4111
|
+
|
|
4112
|
+
this._resetInternalValues(); // Options
|
|
4113
|
+
|
|
4114
|
+
|
|
4115
|
+
this._align = align;
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4118
|
+
var __proto = Camera.prototype;
|
|
4119
|
+
Object.defineProperty(__proto, "element", {
|
|
4120
|
+
// Internal states getter
|
|
4121
|
+
|
|
4122
|
+
/**
|
|
4123
|
+
* The camera element(`.flicking-camera`)
|
|
4124
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)
|
|
4125
|
+
* @type {HTMLElement}
|
|
4126
|
+
* @readonly
|
|
4127
|
+
*/
|
|
4128
|
+
get: function () {
|
|
4129
|
+
return this._el;
|
|
4130
|
+
},
|
|
4131
|
+
enumerable: false,
|
|
4132
|
+
configurable: true
|
|
4133
|
+
});
|
|
4134
|
+
Object.defineProperty(__proto, "children", {
|
|
4135
|
+
/**
|
|
4136
|
+
* An array of the child elements of the camera element(`.flicking-camera`)
|
|
4137
|
+
* @ko 카메라 엘리먼트(`.flicking-camera`)의 자식 엘리먼트 배열
|
|
4138
|
+
* @type {HTMLElement[]}
|
|
4139
|
+
* @readonly
|
|
4140
|
+
*/
|
|
4141
|
+
get: function () {
|
|
4142
|
+
return toArray(this._el.children);
|
|
4143
|
+
},
|
|
4144
|
+
enumerable: false,
|
|
4145
|
+
configurable: true
|
|
4146
|
+
});
|
|
4147
|
+
Object.defineProperty(__proto, "position", {
|
|
4148
|
+
/**
|
|
4149
|
+
* Current position of the camera
|
|
4150
|
+
* @ko Camera의 현재 좌표
|
|
4151
|
+
* @type {number}
|
|
4152
|
+
* @readonly
|
|
4153
|
+
*/
|
|
4154
|
+
get: function () {
|
|
4155
|
+
return this._position;
|
|
4156
|
+
},
|
|
4157
|
+
enumerable: false,
|
|
4158
|
+
configurable: true
|
|
4159
|
+
});
|
|
4160
|
+
Object.defineProperty(__proto, "alignPosition", {
|
|
4161
|
+
/**
|
|
4162
|
+
* Align position inside the viewport where {@link Panel}'s {@link Panel#alignPosition alignPosition} should be located at
|
|
4163
|
+
* @ko 패널의 정렬 기준 위치. 뷰포트 내에서 {@link Panel}의 {@link Panel#alignPosition alignPosition}이 위치해야 하는 곳입니다
|
|
4164
|
+
* @type {number}
|
|
4165
|
+
* @readonly
|
|
4166
|
+
*/
|
|
4167
|
+
get: function () {
|
|
4168
|
+
return this._alignPos;
|
|
4169
|
+
},
|
|
4170
|
+
enumerable: false,
|
|
4171
|
+
configurable: true
|
|
4172
|
+
});
|
|
4173
|
+
Object.defineProperty(__proto, "offset", {
|
|
4174
|
+
/**
|
|
4175
|
+
* Position offset, used for the {@link Flicking#renderOnlyVisible renderOnlyVisible} option
|
|
4176
|
+
* @ko Camera의 좌표 오프셋. {@link Flicking#renderOnlyVisible renderOnlyVisible} 옵션을 위해 사용됩니다.
|
|
4177
|
+
* @type {number}
|
|
4178
|
+
* @default 0
|
|
4179
|
+
* @readonly
|
|
4180
|
+
*/
|
|
4181
|
+
get: function () {
|
|
4182
|
+
return this._offset - this._circularOffset;
|
|
4183
|
+
},
|
|
4184
|
+
enumerable: false,
|
|
4185
|
+
configurable: true
|
|
4186
|
+
});
|
|
4187
|
+
Object.defineProperty(__proto, "circularEnabled", {
|
|
4188
|
+
/**
|
|
4189
|
+
* Whether the `circular` option is enabled.
|
|
4190
|
+
* The {@link Flicking#circular circular} option can't be enabled when sum of the panel sizes are too small.
|
|
4191
|
+
* @ko {@link Flicking#circular circular} 옵션이 활성화되었는지 여부를 나타내는 멤버 변수.
|
|
4192
|
+
* {@link Flicking#circular circular} 옵션은 패널의 크기의 합이 충분하지 않을 경우 비활성화됩니다.
|
|
4193
|
+
* @type {boolean}
|
|
4194
|
+
* @default false
|
|
4195
|
+
* @readonly
|
|
4196
|
+
*/
|
|
4197
|
+
get: function () {
|
|
4198
|
+
return this._circularEnabled;
|
|
4199
|
+
},
|
|
4200
|
+
enumerable: false,
|
|
4201
|
+
configurable: true
|
|
4202
|
+
});
|
|
4203
|
+
Object.defineProperty(__proto, "mode", {
|
|
4204
|
+
/**
|
|
4205
|
+
* A current camera mode
|
|
4206
|
+
* @type {CameraMode}
|
|
4207
|
+
* @readonly
|
|
4208
|
+
*/
|
|
4209
|
+
get: function () {
|
|
4210
|
+
return this._mode;
|
|
4211
|
+
},
|
|
4212
|
+
enumerable: false,
|
|
4213
|
+
configurable: true
|
|
4214
|
+
});
|
|
4215
|
+
Object.defineProperty(__proto, "range", {
|
|
4216
|
+
/**
|
|
4217
|
+
* A range that Camera's {@link Camera#position position} can reach
|
|
4218
|
+
* @ko Camera의 {@link Camera#position position}이 도달 가능한 범위
|
|
4219
|
+
* @type {object}
|
|
4220
|
+
* @property {number} min A minimum position<ko>최소 위치</ko>
|
|
4221
|
+
* @property {number} max A maximum position<ko>최대 위치</ko>
|
|
4222
|
+
* @readonly
|
|
4223
|
+
*/
|
|
4224
|
+
get: function () {
|
|
4225
|
+
return this._range;
|
|
4226
|
+
},
|
|
4227
|
+
enumerable: false,
|
|
4228
|
+
configurable: true
|
|
4229
|
+
});
|
|
4230
|
+
Object.defineProperty(__proto, "rangeDiff", {
|
|
4231
|
+
/**
|
|
4232
|
+
* A difference between Camera's minimum and maximum position that can reach
|
|
4233
|
+
* @ko Camera가 도달 가능한 최소/최대 좌표의 차이
|
|
4234
|
+
* @type {number}
|
|
4235
|
+
* @readonly
|
|
4236
|
+
*/
|
|
4237
|
+
get: function () {
|
|
4238
|
+
return this._range.max - this._range.min;
|
|
4239
|
+
},
|
|
4240
|
+
enumerable: false,
|
|
4241
|
+
configurable: true
|
|
4242
|
+
});
|
|
4243
|
+
Object.defineProperty(__proto, "visiblePanels", {
|
|
4244
|
+
/**
|
|
4245
|
+
* An array of visible panels from the current position
|
|
4246
|
+
* @ko 현재 보이는 패널들의 배열
|
|
4247
|
+
* @type {Panel[]}
|
|
4248
|
+
* @readonly
|
|
4249
|
+
*/
|
|
4250
|
+
get: function () {
|
|
4251
|
+
return this._visiblePanels;
|
|
4252
|
+
},
|
|
4253
|
+
enumerable: false,
|
|
4254
|
+
configurable: true
|
|
4255
|
+
});
|
|
4256
|
+
Object.defineProperty(__proto, "visibleRange", {
|
|
4257
|
+
/**
|
|
4258
|
+
* A range of the visible area from the current position
|
|
4259
|
+
* @ko 현재 위치에서 보이는 범위
|
|
4260
|
+
* @type {object}
|
|
4261
|
+
* @property {number} min A minimum position<ko>최소 위치</ko>
|
|
4262
|
+
* @property {number} min A maximum position<ko>최대 위치</ko>
|
|
4263
|
+
* @readonly
|
|
4264
|
+
*/
|
|
4265
|
+
get: function () {
|
|
4266
|
+
return {
|
|
4267
|
+
min: this._position - this._alignPos,
|
|
4268
|
+
max: this._position - this._alignPos + this.size
|
|
4269
|
+
};
|
|
4270
|
+
},
|
|
4271
|
+
enumerable: false,
|
|
4272
|
+
configurable: true
|
|
4273
|
+
});
|
|
4274
|
+
Object.defineProperty(__proto, "anchorPoints", {
|
|
4275
|
+
/**
|
|
4276
|
+
* An array of {@link AnchorPoint}s that Camera can be stopped at
|
|
4277
|
+
* @ko 카메라가 도달 가능한 {@link AnchorPoint}의 목록
|
|
4278
|
+
* @type {AnchorPoint[]}
|
|
4279
|
+
* @readonly
|
|
4280
|
+
*/
|
|
4281
|
+
get: function () {
|
|
4282
|
+
return this._anchors;
|
|
4283
|
+
},
|
|
4284
|
+
enumerable: false,
|
|
4285
|
+
configurable: true
|
|
4286
|
+
});
|
|
4287
|
+
Object.defineProperty(__proto, "controlParams", {
|
|
4288
|
+
/**
|
|
4289
|
+
* A current parameters of the Camera for updating {@link AxesController}
|
|
4290
|
+
* @ko {@link AxesController}를 업데이트하기 위한 현재 Camera 패러미터들
|
|
4291
|
+
* @type {ControlParams}
|
|
4292
|
+
* @readonly
|
|
4293
|
+
*/
|
|
4294
|
+
get: function () {
|
|
4295
|
+
return {
|
|
4296
|
+
range: this._range,
|
|
4297
|
+
position: this._position,
|
|
4298
|
+
circular: this._circularEnabled
|
|
4299
|
+
};
|
|
4300
|
+
},
|
|
4301
|
+
enumerable: false,
|
|
4302
|
+
configurable: true
|
|
4303
|
+
});
|
|
4304
|
+
Object.defineProperty(__proto, "atEdge", {
|
|
4305
|
+
/**
|
|
4306
|
+
* A Boolean value indicating whether Camera's over the minimum or maximum position reachable
|
|
4307
|
+
* @ko 현재 카메라가 도달 가능한 범위의 최소 혹은 최대점을 넘어섰는지를 나타냅니다
|
|
4308
|
+
* @type {boolean}
|
|
4309
|
+
* @readonly
|
|
4310
|
+
*/
|
|
4311
|
+
get: function () {
|
|
4312
|
+
return this._position <= this._range.min || this._position >= this._range.max;
|
|
4313
|
+
},
|
|
4314
|
+
enumerable: false,
|
|
4315
|
+
configurable: true
|
|
4316
|
+
});
|
|
4317
|
+
Object.defineProperty(__proto, "size", {
|
|
4318
|
+
/**
|
|
4319
|
+
* Return the size of the viewport
|
|
4320
|
+
* @ko 뷰포트 크기를 반환합니다
|
|
4321
|
+
* @type {number}
|
|
4322
|
+
* @readonly
|
|
4323
|
+
*/
|
|
4324
|
+
get: function () {
|
|
4325
|
+
var flicking = this._flicking;
|
|
4326
|
+
return flicking ? flicking.horizontal ? flicking.viewport.width : flicking.viewport.height : 0;
|
|
4327
|
+
},
|
|
4328
|
+
enumerable: false,
|
|
4329
|
+
configurable: true
|
|
4330
|
+
});
|
|
4331
|
+
Object.defineProperty(__proto, "progress", {
|
|
4332
|
+
/**
|
|
4333
|
+
* Return the camera's position progress from the first panel to last panel
|
|
4334
|
+
* Range is from 0 to last panel's index
|
|
4335
|
+
* @ko 첫번째 패널로부터 마지막 패널까지의 카메라 위치의 진행도를 반환합니다
|
|
4336
|
+
* 범위는 0부터 마지막 패널의 인덱스까지입니다
|
|
4337
|
+
* @type {number}
|
|
4338
|
+
* @readonly
|
|
4339
|
+
*/
|
|
4340
|
+
get: function () {
|
|
4341
|
+
var flicking = this._flicking;
|
|
4342
|
+
var position = this._position + this._offset;
|
|
4343
|
+
var nearestAnchor = this.findNearestAnchor(this._position);
|
|
4344
|
+
|
|
4345
|
+
if (!flicking || !nearestAnchor) {
|
|
4346
|
+
return NaN;
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4349
|
+
var nearestPanel = nearestAnchor.panel;
|
|
4350
|
+
var panelPos = nearestPanel.position + nearestPanel.offset;
|
|
4351
|
+
var bounceSize = flicking.control.controller.bounce;
|
|
4352
|
+
var _a = this.range,
|
|
4353
|
+
prevRange = _a.min,
|
|
4354
|
+
nextRange = _a.max;
|
|
4355
|
+
var rangeDiff = this.rangeDiff;
|
|
4356
|
+
|
|
4357
|
+
if (position === panelPos) {
|
|
4358
|
+
return nearestPanel.index;
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4361
|
+
if (position < panelPos) {
|
|
4362
|
+
var prevPanel = nearestPanel.prev();
|
|
4363
|
+
var prevPosition = prevPanel ? prevPanel.position + prevPanel.offset : prevRange - bounceSize[0]; // Looped
|
|
4364
|
+
|
|
4365
|
+
if (prevPosition > panelPos) {
|
|
4366
|
+
prevPosition -= rangeDiff;
|
|
4367
|
+
}
|
|
4105
4368
|
|
|
4369
|
+
return nearestPanel.index - 1 + getProgress(position, prevPosition, panelPos);
|
|
4370
|
+
} else {
|
|
4371
|
+
var nextPanel = nearestPanel.next();
|
|
4372
|
+
var nextPosition = nextPanel ? nextPanel.position + nextPanel.offset : nextRange + bounceSize[1]; // Looped
|
|
4106
4373
|
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
this._anchors = panels.map(function (panel, index) {
|
|
4111
|
-
return new AnchorPoint({
|
|
4112
|
-
index: index,
|
|
4113
|
-
position: panel.position,
|
|
4114
|
-
panel: panel
|
|
4115
|
-
});
|
|
4116
|
-
});
|
|
4117
|
-
return this;
|
|
4118
|
-
};
|
|
4119
|
-
/**
|
|
4120
|
-
* Update Viewport's height to active panel's height
|
|
4121
|
-
* @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
|
|
4122
|
-
* @throws {FlickingError}
|
|
4123
|
-
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4124
|
-
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
4125
|
-
* @chainable
|
|
4126
|
-
* @return {this}
|
|
4127
|
-
*/
|
|
4374
|
+
if (nextPosition < panelPos) {
|
|
4375
|
+
nextPosition += rangeDiff;
|
|
4376
|
+
}
|
|
4128
4377
|
|
|
4378
|
+
return nearestPanel.index + getProgress(position, panelPos, nextPosition);
|
|
4379
|
+
}
|
|
4380
|
+
},
|
|
4381
|
+
enumerable: false,
|
|
4382
|
+
configurable: true
|
|
4383
|
+
});
|
|
4384
|
+
Object.defineProperty(__proto, "align", {
|
|
4385
|
+
// Options Getter
|
|
4129
4386
|
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4387
|
+
/**
|
|
4388
|
+
* A value indicating where the {@link Camera#alignPosition alignPosition} should be located at inside the viewport element
|
|
4389
|
+
* @ko {@link Camera#alignPosition alignPosition}이 뷰포트 엘리먼트 내의 어디에 위치해야 하는지를 나타내는 값
|
|
4390
|
+
* @type {ALIGN | string | number}
|
|
4391
|
+
*/
|
|
4392
|
+
get: function () {
|
|
4393
|
+
return this._align;
|
|
4394
|
+
},
|
|
4395
|
+
// Options Setter
|
|
4396
|
+
set: function (val) {
|
|
4397
|
+
this._align = val;
|
|
4398
|
+
},
|
|
4399
|
+
enumerable: false,
|
|
4400
|
+
configurable: true
|
|
4401
|
+
});
|
|
4138
4402
|
/**
|
|
4139
|
-
*
|
|
4140
|
-
* @ko
|
|
4141
|
-
* @
|
|
4403
|
+
* Initialize Camera
|
|
4404
|
+
* @ko Camera를 초기화합니다
|
|
4405
|
+
* @throws {FlickingError}
|
|
4406
|
+
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
4407
|
+
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
4142
4408
|
* @return {this}
|
|
4143
4409
|
*/
|
|
4144
4410
|
|
|
4411
|
+
__proto.init = function () {
|
|
4412
|
+
var viewportEl = this._flicking.viewport.element;
|
|
4413
|
+
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
4414
|
+
this._el = viewportEl.firstElementChild;
|
|
4145
4415
|
|
|
4146
|
-
|
|
4147
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4148
|
-
var position = this._position;
|
|
4149
|
-
var unRenderedPanels = flicking.panels.filter(function (panel) {
|
|
4150
|
-
return !panel.rendered;
|
|
4151
|
-
});
|
|
4152
|
-
this._offset = unRenderedPanels.filter(function (panel) {
|
|
4153
|
-
return panel.position + panel.offset < position;
|
|
4154
|
-
}).reduce(function (offset, panel) {
|
|
4155
|
-
return offset + panel.sizeIncludingMargin;
|
|
4156
|
-
}, 0);
|
|
4157
|
-
this.applyTransform();
|
|
4158
|
-
return this;
|
|
4159
|
-
};
|
|
4160
|
-
/**
|
|
4161
|
-
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
4162
|
-
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
4163
|
-
* @chainable
|
|
4164
|
-
* @return {this}
|
|
4165
|
-
*/
|
|
4416
|
+
this._checkTranslateSupport();
|
|
4166
4417
|
|
|
4418
|
+
this._updateMode();
|
|
4167
4419
|
|
|
4168
|
-
__proto.resetNeedPanelHistory = function () {
|
|
4169
|
-
this._needPanelTriggered = {
|
|
4170
|
-
prev: false,
|
|
4171
|
-
next: false
|
|
4172
|
-
};
|
|
4173
4420
|
return this;
|
|
4174
4421
|
};
|
|
4175
4422
|
/**
|
|
4176
|
-
*
|
|
4177
|
-
* @ko
|
|
4178
|
-
* @
|
|
4179
|
-
* @return {this}
|
|
4423
|
+
* Destroy Camera and return to initial state
|
|
4424
|
+
* @ko Camera를 초기 상태로 되돌립니다
|
|
4425
|
+
* @return {void}
|
|
4180
4426
|
*/
|
|
4181
4427
|
|
|
4182
4428
|
|
|
4183
|
-
__proto.
|
|
4184
|
-
|
|
4185
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4186
|
-
var actualPosition = this._position - this._alignPos - this._offset;
|
|
4187
|
-
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4188
|
-
return this;
|
|
4189
|
-
};
|
|
4190
|
-
|
|
4191
|
-
__proto._resetInternalValues = function () {
|
|
4192
|
-
this._position = 0;
|
|
4193
|
-
this._alignPos = 0;
|
|
4194
|
-
this._offset = 0;
|
|
4195
|
-
this._range = {
|
|
4196
|
-
min: 0,
|
|
4197
|
-
max: 0
|
|
4198
|
-
};
|
|
4199
|
-
this._visiblePanels = [];
|
|
4200
|
-
this._anchors = [];
|
|
4201
|
-
this._needPanelTriggered = {
|
|
4202
|
-
prev: false,
|
|
4203
|
-
next: false
|
|
4204
|
-
};
|
|
4205
|
-
};
|
|
4206
|
-
|
|
4207
|
-
__proto._refreshVisiblePanels = function () {
|
|
4208
|
-
var _this = this;
|
|
4209
|
-
|
|
4210
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4211
|
-
var panels = flicking.renderer.panels;
|
|
4212
|
-
var newVisiblePanels = panels.filter(function (panel) {
|
|
4213
|
-
return _this.canSee(panel);
|
|
4214
|
-
});
|
|
4215
|
-
var prevVisiblePanels = this._visiblePanels;
|
|
4216
|
-
this._visiblePanels = newVisiblePanels;
|
|
4217
|
-
var added = newVisiblePanels.filter(function (panel) {
|
|
4218
|
-
return !includes(prevVisiblePanels, panel);
|
|
4219
|
-
});
|
|
4220
|
-
var removed = prevVisiblePanels.filter(function (panel) {
|
|
4221
|
-
return !includes(newVisiblePanels, panel);
|
|
4222
|
-
});
|
|
4223
|
-
|
|
4224
|
-
if (added.length > 0 || removed.length > 0) {
|
|
4225
|
-
void flicking.renderer.render().then(function () {
|
|
4226
|
-
flicking.trigger(new ComponentEvent(EVENTS.VISIBLE_CHANGE, {
|
|
4227
|
-
added: added,
|
|
4228
|
-
removed: removed,
|
|
4229
|
-
visiblePanels: newVisiblePanels
|
|
4230
|
-
}));
|
|
4231
|
-
});
|
|
4232
|
-
}
|
|
4233
|
-
};
|
|
4234
|
-
|
|
4235
|
-
__proto._checkNeedPanel = function () {
|
|
4236
|
-
var needPanelTriggered = this._needPanelTriggered;
|
|
4237
|
-
if (needPanelTriggered.prev && needPanelTriggered.next) return;
|
|
4238
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4239
|
-
var panels = flicking.renderer.panels;
|
|
4240
|
-
|
|
4241
|
-
if (panels.length <= 0) {
|
|
4242
|
-
if (!needPanelTriggered.prev) {
|
|
4243
|
-
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4244
|
-
direction: DIRECTION.PREV
|
|
4245
|
-
}));
|
|
4246
|
-
needPanelTriggered.prev = true;
|
|
4247
|
-
}
|
|
4248
|
-
|
|
4249
|
-
if (!needPanelTriggered.next) {
|
|
4250
|
-
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4251
|
-
direction: DIRECTION.NEXT
|
|
4252
|
-
}));
|
|
4253
|
-
needPanelTriggered.next = true;
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
return;
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
|
-
var cameraPosition = this._position;
|
|
4260
|
-
var cameraSize = this.size;
|
|
4261
|
-
var cameraRange = this._range;
|
|
4262
|
-
var needPanelThreshold = flicking.needPanelThreshold;
|
|
4263
|
-
var cameraPrev = cameraPosition - this._alignPos;
|
|
4264
|
-
var cameraNext = cameraPrev + cameraSize;
|
|
4265
|
-
var firstPanel = panels[0];
|
|
4266
|
-
var lastPanel = panels[panels.length - 1];
|
|
4267
|
-
|
|
4268
|
-
if (!needPanelTriggered.prev) {
|
|
4269
|
-
var firstPanelPrev = firstPanel.range.min;
|
|
4270
|
-
|
|
4271
|
-
if (cameraPrev <= firstPanelPrev + needPanelThreshold || cameraPosition <= cameraRange.min + needPanelThreshold) {
|
|
4272
|
-
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4273
|
-
direction: DIRECTION.PREV
|
|
4274
|
-
}));
|
|
4275
|
-
needPanelTriggered.prev = true;
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4278
|
-
|
|
4279
|
-
if (!needPanelTriggered.next) {
|
|
4280
|
-
var lastPanelNext = lastPanel.range.max;
|
|
4281
|
-
|
|
4282
|
-
if (cameraNext >= lastPanelNext - needPanelThreshold || cameraPosition >= cameraRange.max - needPanelThreshold) {
|
|
4283
|
-
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4284
|
-
direction: DIRECTION.NEXT
|
|
4285
|
-
}));
|
|
4286
|
-
needPanelTriggered.next = true;
|
|
4287
|
-
}
|
|
4288
|
-
}
|
|
4289
|
-
};
|
|
4429
|
+
__proto.destroy = function () {
|
|
4430
|
+
this._resetInternalValues();
|
|
4290
4431
|
|
|
4291
|
-
|
|
4292
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4293
|
-
var range = this._range;
|
|
4294
|
-
var wasBetweenRange = prevPos > range.min && prevPos < range.max;
|
|
4295
|
-
var isBetweenRange = newPos > range.min && newPos < range.max;
|
|
4296
|
-
if (!wasBetweenRange || isBetweenRange) return;
|
|
4297
|
-
var direction = newPos <= range.min ? DIRECTION.PREV : DIRECTION.NEXT;
|
|
4298
|
-
flicking.trigger(new ComponentEvent(EVENTS.REACH_EDGE, {
|
|
4299
|
-
direction: direction
|
|
4300
|
-
}));
|
|
4432
|
+
return this;
|
|
4301
4433
|
};
|
|
4302
|
-
|
|
4303
|
-
return Camera;
|
|
4304
|
-
}();
|
|
4305
|
-
|
|
4306
|
-
/**
|
|
4307
|
-
* A {@link Camera} that can move from the position of the first panel to the position of the last panel
|
|
4308
|
-
* @ko 첫번째 패널의 좌표로부터 마지막 패널의 좌표로까지 이동할 수 있는 종류의 {@link Camera}
|
|
4309
|
-
*/
|
|
4310
|
-
|
|
4311
|
-
var LinearCamera =
|
|
4312
|
-
/*#__PURE__*/
|
|
4313
|
-
function (_super) {
|
|
4314
|
-
__extends(LinearCamera, _super);
|
|
4315
|
-
|
|
4316
|
-
function LinearCamera() {
|
|
4317
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4318
|
-
}
|
|
4319
4434
|
/**
|
|
4320
|
-
*
|
|
4321
|
-
* @ko
|
|
4322
|
-
* @
|
|
4435
|
+
* Move to the given position and apply CSS transform
|
|
4436
|
+
* @ko 해당 좌표로 이동하고, CSS transform을 적용합니다
|
|
4437
|
+
* @param {number} pos A new position<ko>움직일 위치</ko>
|
|
4323
4438
|
* @throws {FlickingError}
|
|
4324
4439
|
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4325
4440
|
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
4326
4441
|
* @return {this}
|
|
4327
|
-
*/
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
var __proto = LinearCamera.prototype;
|
|
4331
|
-
|
|
4332
|
-
__proto.updateRange = function () {
|
|
4333
|
-
var _a, _b;
|
|
4334
|
-
|
|
4335
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4336
|
-
var renderer = flicking.renderer;
|
|
4337
|
-
var firstPanel = renderer.getPanel(0);
|
|
4338
|
-
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
4339
|
-
this._range = {
|
|
4340
|
-
min: (_a = firstPanel === null || firstPanel === void 0 ? void 0 : firstPanel.position) !== null && _a !== void 0 ? _a : 0,
|
|
4341
|
-
max: (_b = lastPanel === null || lastPanel === void 0 ? void 0 : lastPanel.position) !== null && _b !== void 0 ? _b : 0
|
|
4342
|
-
};
|
|
4343
|
-
return this;
|
|
4344
|
-
};
|
|
4442
|
+
*/
|
|
4345
4443
|
|
|
4346
|
-
return LinearCamera;
|
|
4347
|
-
}(Camera);
|
|
4348
4444
|
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
* @ko 첫번째 패널과 마지막 패널이 이어진 상태로, 무한히 회전할 수 있는 종류의 {@link Camera}
|
|
4352
|
-
*/
|
|
4445
|
+
__proto.lookAt = function (pos) {
|
|
4446
|
+
var _this = this;
|
|
4353
4447
|
|
|
4354
|
-
var
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
__extends(CircularCamera, _super);
|
|
4448
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4449
|
+
var prevPos = this._position;
|
|
4450
|
+
this._position = pos;
|
|
4358
4451
|
|
|
4359
|
-
|
|
4360
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4452
|
+
var toggled = this._togglePanels(prevPos, pos);
|
|
4361
4453
|
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4454
|
+
this._refreshVisiblePanels();
|
|
4455
|
+
|
|
4456
|
+
this._checkNeedPanel();
|
|
4457
|
+
|
|
4458
|
+
this._checkReachEnd(prevPos, pos);
|
|
4459
|
+
|
|
4460
|
+
if (toggled) {
|
|
4461
|
+
void flicking.renderer.render().then(function () {
|
|
4462
|
+
_this.updateOffset();
|
|
4463
|
+
});
|
|
4464
|
+
} else {
|
|
4465
|
+
this.applyTransform();
|
|
4466
|
+
}
|
|
4467
|
+
};
|
|
4468
|
+
/**
|
|
4469
|
+
* Return a previous {@link AnchorPoint} of given {@link AnchorPoint}
|
|
4470
|
+
* If it does not exist, return `null` instead
|
|
4471
|
+
* @ko 주어진 {@link AnchorPoint}의 이전 {@link AnchorPoint}를 반환합니다
|
|
4472
|
+
* 존재하지 않을 경우 `null`을 반환합니다
|
|
4473
|
+
* @param {AnchorPoint} anchor A reference {@link AnchorPoint}<ko>기준 {@link AnchorPoint}</ko>
|
|
4474
|
+
* @return {AnchorPoint | null} The previous {@link AnchorPoint}<ko>이전 {@link AnchorPoint}</ko>
|
|
4475
|
+
*/
|
|
4366
4476
|
|
|
4367
|
-
var __proto = CircularCamera.prototype;
|
|
4368
|
-
Object.defineProperty(__proto, "offset", {
|
|
4369
|
-
get: function () {
|
|
4370
|
-
return this._offset - this._circularOffset;
|
|
4371
|
-
},
|
|
4372
|
-
enumerable: false,
|
|
4373
|
-
configurable: true
|
|
4374
|
-
});
|
|
4375
|
-
Object.defineProperty(__proto, "controlParams", {
|
|
4376
|
-
get: function () {
|
|
4377
|
-
return {
|
|
4378
|
-
range: this._range,
|
|
4379
|
-
position: this._position,
|
|
4380
|
-
circular: this._circularEnabled
|
|
4381
|
-
};
|
|
4382
|
-
},
|
|
4383
|
-
enumerable: false,
|
|
4384
|
-
configurable: true
|
|
4385
|
-
});
|
|
4386
4477
|
|
|
4387
4478
|
__proto.getPrevAnchor = function (anchor) {
|
|
4388
|
-
if (!this._circularEnabled || anchor.index !== 0)
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4479
|
+
if (!this._circularEnabled || anchor.index !== 0) {
|
|
4480
|
+
return this._anchors[anchor.index - 1] || null;
|
|
4481
|
+
} else {
|
|
4482
|
+
var anchors = this._anchors;
|
|
4483
|
+
var rangeDiff = this.rangeDiff;
|
|
4484
|
+
var lastAnchor = anchors[anchors.length - 1];
|
|
4485
|
+
return new AnchorPoint({
|
|
4486
|
+
index: lastAnchor.index,
|
|
4487
|
+
position: lastAnchor.position - rangeDiff,
|
|
4488
|
+
panel: lastAnchor.panel
|
|
4489
|
+
});
|
|
4490
|
+
}
|
|
4397
4491
|
};
|
|
4492
|
+
/**
|
|
4493
|
+
* Return a next {@link AnchorPoint} of given {@link AnchorPoint}
|
|
4494
|
+
* If it does not exist, return `null` instead
|
|
4495
|
+
* @ko 주어진 {@link AnchorPoint}의 다음 {@link AnchorPoint}를 반환합니다
|
|
4496
|
+
* 존재하지 않을 경우 `null`을 반환합니다
|
|
4497
|
+
* @param {AnchorPoint} anchor A reference {@link AnchorPoint}<ko>기준 {@link AnchorPoint}</ko>
|
|
4498
|
+
* @return {AnchorPoint | null} The next {@link AnchorPoint}<ko>다음 {@link AnchorPoint}</ko>
|
|
4499
|
+
*/
|
|
4500
|
+
|
|
4398
4501
|
|
|
4399
4502
|
__proto.getNextAnchor = function (anchor) {
|
|
4400
4503
|
var anchors = this._anchors;
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4504
|
+
|
|
4505
|
+
if (!this._circularEnabled || anchor.index !== anchors.length - 1) {
|
|
4506
|
+
return anchors[anchor.index + 1] || null;
|
|
4507
|
+
} else {
|
|
4508
|
+
var rangeDiff = this.rangeDiff;
|
|
4509
|
+
var firstAnchor = anchors[0];
|
|
4510
|
+
return new AnchorPoint({
|
|
4511
|
+
index: firstAnchor.index,
|
|
4512
|
+
position: firstAnchor.position + rangeDiff,
|
|
4513
|
+
panel: firstAnchor.panel
|
|
4514
|
+
});
|
|
4515
|
+
}
|
|
4516
|
+
};
|
|
4517
|
+
/**
|
|
4518
|
+
* Return the camera's position progress in the panel below
|
|
4519
|
+
* Value is from 0 to 1 when the camera's inside panel
|
|
4520
|
+
* Value can be lower than 0 or bigger than 1 when it's in the margin area
|
|
4521
|
+
* @ko 현재 카메라 아래 패널에서의 위치 진행도를 반환합니다
|
|
4522
|
+
* 반환값은 카메라가 패널 내부에 있을 경우 0부터 1까지의 값을 갖습니다
|
|
4523
|
+
* 패널의 margin 영역에 있을 경우 0보다 작거나 1보다 큰 값을 반환할 수 있습니다
|
|
4524
|
+
*/
|
|
4525
|
+
|
|
4526
|
+
|
|
4527
|
+
__proto.getProgressInPanel = function (panel) {
|
|
4528
|
+
var panelRange = panel.range;
|
|
4529
|
+
return (this._position - panelRange.min) / (panelRange.max - panelRange.min);
|
|
4409
4530
|
};
|
|
4531
|
+
/**
|
|
4532
|
+
* Return {@link AnchorPoint} that includes given position
|
|
4533
|
+
* If there's no {@link AnchorPoint} that includes the given position, return `null` instead
|
|
4534
|
+
* @ko 주어진 좌표를 포함하는 {@link AnchorPoint}를 반환합니다
|
|
4535
|
+
* 주어진 좌표를 포함하는 {@link AnchorPoint}가 없을 경우 `null`을 반환합니다
|
|
4536
|
+
* @param {number} position A position to check<ko>확인할 좌표</ko>
|
|
4537
|
+
* @return {AnchorPoint | null} The {@link AnchorPoint} that includes the given position<ko>해당 좌표를 포함하는 {@link AnchorPoint}</ko>
|
|
4538
|
+
*/
|
|
4539
|
+
|
|
4410
4540
|
|
|
4411
4541
|
__proto.findAnchorIncludePosition = function (position) {
|
|
4412
|
-
|
|
4413
|
-
|
|
4542
|
+
return this._mode.findAnchorIncludePosition(position);
|
|
4543
|
+
};
|
|
4544
|
+
/**
|
|
4545
|
+
* Return {@link AnchorPoint} nearest to given position
|
|
4546
|
+
* If there're no {@link AnchorPoint}s, return `null` instead
|
|
4547
|
+
* @ko 해당 좌표에서 가장 가까운 {@link AnchorPoint}를 반환합니다
|
|
4548
|
+
* {@link AnchorPoint}가 하나도 없을 경우 `null`을 반환합니다
|
|
4549
|
+
* @param {number} position A position to check<ko>확인할 좌표</ko>
|
|
4550
|
+
* @return {AnchorPoint | null} The {@link AnchorPoint} nearest to the given position<ko>해당 좌표에 가장 인접한 {@link AnchorPoint}</ko>
|
|
4551
|
+
*/
|
|
4552
|
+
|
|
4553
|
+
|
|
4554
|
+
__proto.findNearestAnchor = function (position) {
|
|
4414
4555
|
var anchors = this._anchors;
|
|
4415
|
-
|
|
4416
|
-
var
|
|
4417
|
-
var positionInRange = circulatePosition(position, range.min, range.max);
|
|
4556
|
+
if (anchors.length <= 0) return null;
|
|
4557
|
+
var prevDist = Infinity;
|
|
4418
4558
|
|
|
4419
|
-
var
|
|
4559
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
4560
|
+
var anchor = anchors[anchorIdx];
|
|
4561
|
+
var dist = Math.abs(anchor.position - position);
|
|
4420
4562
|
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
panel: anchors[0].panel
|
|
4426
|
-
}), new AnchorPoint({
|
|
4427
|
-
index: anchorCount - 1,
|
|
4428
|
-
position: anchors[anchorCount - 1].position - rangeDiff,
|
|
4429
|
-
panel: anchors[anchorCount - 1].panel
|
|
4430
|
-
})].filter(function (anchor) {
|
|
4431
|
-
return !!anchor;
|
|
4432
|
-
});
|
|
4433
|
-
anchorInRange = possibleAnchors.reduce(function (nearest, anchor) {
|
|
4434
|
-
if (!nearest) return anchor;
|
|
4435
|
-
return Math.abs(nearest.position - position) < Math.abs(anchor.position - position) ? nearest : anchor;
|
|
4436
|
-
}, null);
|
|
4437
|
-
}
|
|
4563
|
+
if (dist > prevDist) {
|
|
4564
|
+
// Return previous anchor
|
|
4565
|
+
return anchors[anchorIdx - 1];
|
|
4566
|
+
}
|
|
4438
4567
|
|
|
4439
|
-
|
|
4568
|
+
prevDist = dist;
|
|
4569
|
+
} // Return last anchor
|
|
4440
4570
|
|
|
4441
|
-
if (position < range.min) {
|
|
4442
|
-
var loopCount = -Math.floor((range.min - position) / rangeDiff) - 1;
|
|
4443
|
-
return new AnchorPoint({
|
|
4444
|
-
index: anchorInRange.index,
|
|
4445
|
-
position: anchorInRange.position + rangeDiff * loopCount,
|
|
4446
|
-
panel: anchorInRange.panel
|
|
4447
|
-
});
|
|
4448
|
-
} else if (position > range.max) {
|
|
4449
|
-
var loopCount = Math.floor((position - range.max) / rangeDiff) + 1;
|
|
4450
|
-
return new AnchorPoint({
|
|
4451
|
-
index: anchorInRange.index,
|
|
4452
|
-
position: anchorInRange.position + rangeDiff * loopCount,
|
|
4453
|
-
panel: anchorInRange.panel
|
|
4454
|
-
});
|
|
4455
|
-
}
|
|
4456
4571
|
|
|
4457
|
-
return
|
|
4572
|
+
return anchors[anchors.length - 1];
|
|
4458
4573
|
};
|
|
4574
|
+
/**
|
|
4575
|
+
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
4576
|
+
* @ko 현재 {@link Flicking#currentPanel}에 해당하는 {@link AnchorPoint}를 반환합니다
|
|
4577
|
+
* @return {AnchorPoint | null}
|
|
4578
|
+
*/
|
|
4459
4579
|
|
|
4460
|
-
__proto.clampToReachablePosition = function (position) {
|
|
4461
|
-
// Basically all position is reachable for circular camera
|
|
4462
|
-
return this._circularEnabled ? position : _super.prototype.clampToReachablePosition.call(this, position);
|
|
4463
|
-
};
|
|
4464
4580
|
|
|
4465
|
-
__proto.
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4581
|
+
__proto.findActiveAnchor = function () {
|
|
4582
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4583
|
+
var activeIndex = flicking.control.activeIndex;
|
|
4584
|
+
return find(this._anchors, function (anchor) {
|
|
4585
|
+
return anchor.panel.index === activeIndex;
|
|
4586
|
+
});
|
|
4469
4587
|
};
|
|
4588
|
+
/**
|
|
4589
|
+
* Clamp the given position between camera's range
|
|
4590
|
+
* @ko 주어진 좌표를 Camera가 도달 가능한 범위 사이의 값으로 만듭니다
|
|
4591
|
+
* @param {number} position A position to clamp<ko>범위를 제한할 좌표</ko>
|
|
4592
|
+
* @return {number} A clamped position<ko>범위 제한된 좌표</ko>
|
|
4593
|
+
*/
|
|
4470
4594
|
|
|
4471
|
-
__proto.canSee = function (panel) {
|
|
4472
|
-
var range = this._range;
|
|
4473
|
-
var rangeDiff = this.rangeDiff;
|
|
4474
|
-
var visibleRange = this.visibleRange;
|
|
4475
4595
|
|
|
4476
|
-
|
|
4596
|
+
__proto.clampToReachablePosition = function (position) {
|
|
4597
|
+
return this._mode.clampToReachablePosition(position);
|
|
4598
|
+
};
|
|
4599
|
+
/**
|
|
4600
|
+
* Check whether the given panel is inside of the Camera's range
|
|
4601
|
+
* @ko 해당 {@link Panel}이 Camera가 도달 가능한 범위 내에 있는지를 반환합니다
|
|
4602
|
+
* @param panel An instance of {@link Panel} to check<ko>확인할 {@link Panel}의 인스턴스</ko>
|
|
4603
|
+
* @return {boolean} Whether the panel's inside Camera's range<ko>도달 가능한 범위 내에 해당 패널이 존재하는지 여부</ko>
|
|
4604
|
+
*/
|
|
4477
4605
|
|
|
4478
|
-
if (!this._circularEnabled) {
|
|
4479
|
-
return visibleInCurrentRange;
|
|
4480
|
-
} // Check looped visible area for circular case
|
|
4481
4606
|
|
|
4607
|
+
__proto.canReach = function (panel) {
|
|
4608
|
+
return this._mode.canReach(panel);
|
|
4609
|
+
};
|
|
4610
|
+
/**
|
|
4611
|
+
* Check whether the given panel element is visible at the current position
|
|
4612
|
+
* @ko 현재 좌표에서 해당 패널 엘리먼트를 볼 수 있는지 여부를 반환합니다
|
|
4613
|
+
* @param panel An instance of {@link Panel} to check<ko>확인할 {@link Panel}의 인스턴스</ko>
|
|
4614
|
+
* @return Whether the panel element is visible at the current position<ko>현재 위치에서 해당 패널 엘리먼트가 보이는지 여부</ko>
|
|
4615
|
+
*/
|
|
4482
4616
|
|
|
4483
|
-
if (visibleRange.min < range.min) {
|
|
4484
|
-
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min + rangeDiff, visibleRange.max + rangeDiff);
|
|
4485
|
-
} else if (visibleRange.max > range.max) {
|
|
4486
|
-
return visibleInCurrentRange || panel.isVisibleOnRange(visibleRange.min - rangeDiff, visibleRange.max - rangeDiff);
|
|
4487
|
-
}
|
|
4488
4617
|
|
|
4489
|
-
|
|
4618
|
+
__proto.canSee = function (panel) {
|
|
4619
|
+
return this._mode.canSee(panel);
|
|
4490
4620
|
};
|
|
4491
4621
|
/**
|
|
4492
4622
|
* Update {@link Camera#range range} of Camera
|
|
4493
4623
|
* @ko Camera의 {@link Camera#range range}를 업데이트합니다
|
|
4624
|
+
* @method
|
|
4625
|
+
* @abstract
|
|
4626
|
+
* @memberof Camera
|
|
4627
|
+
* @instance
|
|
4628
|
+
* @name updateRange
|
|
4494
4629
|
* @chainable
|
|
4495
4630
|
* @throws {FlickingError}
|
|
4496
4631
|
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
@@ -4504,287 +4639,269 @@ function (_super) {
|
|
|
4504
4639
|
var renderer = flicking.renderer;
|
|
4505
4640
|
var panels = renderer.panels;
|
|
4506
4641
|
|
|
4507
|
-
|
|
4508
|
-
this._resetInternalValues();
|
|
4509
|
-
|
|
4510
|
-
return this;
|
|
4511
|
-
}
|
|
4642
|
+
this._updateMode();
|
|
4512
4643
|
|
|
4513
|
-
|
|
4514
|
-
var lastPanel = panels[panels.length - 1];
|
|
4515
|
-
var firstPanelPrev = firstPanel.range.min - firstPanel.margin.prev;
|
|
4516
|
-
var lastPanelNext = lastPanel.range.max + lastPanel.margin.next;
|
|
4517
|
-
var visibleSize = this.size;
|
|
4518
|
-
var panelSizeSum = lastPanelNext - firstPanelPrev;
|
|
4519
|
-
var canSetCircularMode = panels.every(function (panel) {
|
|
4520
|
-
return panelSizeSum - panel.size >= visibleSize;
|
|
4521
|
-
});
|
|
4522
|
-
this._circularEnabled = canSetCircularMode;
|
|
4644
|
+
this._range = this._mode.getRange();
|
|
4523
4645
|
|
|
4524
|
-
if (
|
|
4525
|
-
this._range = {
|
|
4526
|
-
min: firstPanelPrev,
|
|
4527
|
-
max: lastPanelNext
|
|
4528
|
-
};
|
|
4646
|
+
if (this._circularEnabled) {
|
|
4529
4647
|
panels.forEach(function (panel) {
|
|
4530
4648
|
return panel.updateCircularToggleDirection();
|
|
4531
4649
|
});
|
|
4532
|
-
} else {
|
|
4533
|
-
this._range = {
|
|
4534
|
-
min: firstPanel.position,
|
|
4535
|
-
max: lastPanel.position
|
|
4536
|
-
};
|
|
4537
4650
|
}
|
|
4538
4651
|
|
|
4539
|
-
this.updateOffset();
|
|
4540
4652
|
return this;
|
|
4541
4653
|
};
|
|
4654
|
+
/**
|
|
4655
|
+
* Update Camera's {@link Camera#alignPosition alignPosition}
|
|
4656
|
+
* @ko Camera의 {@link Camera#alignPosition alignPosition}을 업데이트합니다
|
|
4657
|
+
* @chainable
|
|
4658
|
+
* @return {this}
|
|
4659
|
+
*/
|
|
4660
|
+
|
|
4661
|
+
|
|
4662
|
+
__proto.updateAlignPos = function () {
|
|
4663
|
+
var align = this._align;
|
|
4664
|
+
var alignVal = typeof align === "object" ? align.camera : align;
|
|
4665
|
+
this._alignPos = parseAlign$1(alignVal, this.size);
|
|
4666
|
+
return this;
|
|
4667
|
+
};
|
|
4668
|
+
/**
|
|
4669
|
+
* Update Camera's {@link Camera#anchorPoints anchorPoints}
|
|
4670
|
+
* @ko Camera의 {@link Camera#anchorPoints anchorPoints}를 업데이트합니다
|
|
4671
|
+
* @throws {FlickingError}
|
|
4672
|
+
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4673
|
+
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
4674
|
+
* @chainable
|
|
4675
|
+
* @return {this}
|
|
4676
|
+
*/
|
|
4677
|
+
|
|
4678
|
+
|
|
4679
|
+
__proto.updateAnchors = function () {
|
|
4680
|
+
this._anchors = this._mode.getAnchors();
|
|
4681
|
+
return this;
|
|
4682
|
+
};
|
|
4683
|
+
/**
|
|
4684
|
+
* Update Viewport's height to active panel's height
|
|
4685
|
+
* @ko 현재 선택된 패널의 높이와 동일하도록 뷰포트의 높이를 업데이트합니다
|
|
4686
|
+
* @throws {FlickingError}
|
|
4687
|
+
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4688
|
+
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
4689
|
+
* @chainable
|
|
4690
|
+
* @return {this}
|
|
4691
|
+
*/
|
|
4542
4692
|
|
|
4543
|
-
__proto.updateOffset = function () {
|
|
4544
|
-
this._updateCircularOffset();
|
|
4545
4693
|
|
|
4546
|
-
|
|
4694
|
+
__proto.updateAdaptiveHeight = function () {
|
|
4695
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4696
|
+
var activePanel = flicking.control.activePanel;
|
|
4697
|
+
if (!flicking.horizontal || !flicking.adaptive || !activePanel) return;
|
|
4698
|
+
flicking.viewport.setSize({
|
|
4699
|
+
height: activePanel.height
|
|
4700
|
+
});
|
|
4547
4701
|
};
|
|
4702
|
+
/**
|
|
4703
|
+
* Update current offset of the camera
|
|
4704
|
+
* @ko 현재 카메라의 오프셋을 업데이트합니다
|
|
4705
|
+
* @chainable
|
|
4706
|
+
* @return {this}
|
|
4707
|
+
*/
|
|
4548
4708
|
|
|
4549
|
-
__proto.lookAt = function (pos) {
|
|
4550
|
-
var _this = this;
|
|
4551
4709
|
|
|
4710
|
+
__proto.updateOffset = function () {
|
|
4552
4711
|
var flicking = getFlickingAttached(this._flicking);
|
|
4553
|
-
var
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
var toggled = panels.map(function (panel) {
|
|
4557
|
-
return panel.toggle(prevPos, pos);
|
|
4712
|
+
var position = this._position;
|
|
4713
|
+
var unRenderedPanels = flicking.panels.filter(function (panel) {
|
|
4714
|
+
return !panel.rendered;
|
|
4558
4715
|
});
|
|
4559
|
-
this.
|
|
4716
|
+
this._offset = unRenderedPanels.filter(function (panel) {
|
|
4717
|
+
return panel.position + panel.offset < position;
|
|
4718
|
+
}).reduce(function (offset, panel) {
|
|
4719
|
+
return offset + panel.sizeIncludingMargin;
|
|
4720
|
+
}, 0);
|
|
4721
|
+
this._circularOffset = this._mode.getCircularOffset();
|
|
4722
|
+
this.applyTransform();
|
|
4723
|
+
return this;
|
|
4724
|
+
};
|
|
4725
|
+
/**
|
|
4726
|
+
* Reset the history of {@link Flicking#event:needPanel needPanel} events so it can be triggered again
|
|
4727
|
+
* @ko 발생한 {@link Flicking#event:needPanel needPanel} 이벤트들을 초기화하여 다시 발생할 수 있도록 합니다
|
|
4728
|
+
* @chainable
|
|
4729
|
+
* @return {this}
|
|
4730
|
+
*/
|
|
4560
4731
|
|
|
4561
|
-
_super.prototype.lookAt.call(this, pos);
|
|
4562
4732
|
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
}
|
|
4733
|
+
__proto.resetNeedPanelHistory = function () {
|
|
4734
|
+
this._needPanelTriggered = {
|
|
4735
|
+
prev: false,
|
|
4736
|
+
next: false
|
|
4737
|
+
};
|
|
4738
|
+
return this;
|
|
4570
4739
|
};
|
|
4740
|
+
/**
|
|
4741
|
+
* Apply "transform" style with the current position to camera element
|
|
4742
|
+
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
4743
|
+
* @return {this}
|
|
4744
|
+
*/
|
|
4745
|
+
|
|
4571
4746
|
|
|
4572
4747
|
__proto.applyTransform = function () {
|
|
4573
4748
|
var el = this._el;
|
|
4574
4749
|
var flicking = getFlickingAttached(this._flicking);
|
|
4750
|
+
var renderer = flicking.renderer;
|
|
4751
|
+
if (renderer.rendering) return this;
|
|
4575
4752
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4576
4753
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4577
4754
|
return this;
|
|
4578
4755
|
};
|
|
4579
4756
|
|
|
4580
4757
|
__proto._resetInternalValues = function () {
|
|
4581
|
-
|
|
4582
|
-
|
|
4758
|
+
this._position = 0;
|
|
4759
|
+
this._alignPos = 0;
|
|
4760
|
+
this._offset = 0;
|
|
4583
4761
|
this._circularOffset = 0;
|
|
4584
4762
|
this._circularEnabled = false;
|
|
4763
|
+
this._range = {
|
|
4764
|
+
min: 0,
|
|
4765
|
+
max: 0
|
|
4766
|
+
};
|
|
4767
|
+
this._visiblePanels = [];
|
|
4768
|
+
this._anchors = [];
|
|
4769
|
+
this._needPanelTriggered = {
|
|
4770
|
+
prev: false,
|
|
4771
|
+
next: false
|
|
4772
|
+
};
|
|
4585
4773
|
};
|
|
4586
4774
|
|
|
4587
|
-
__proto.
|
|
4588
|
-
|
|
4589
|
-
return sum + panel.sizeIncludingMargin;
|
|
4590
|
-
}, 0);
|
|
4591
|
-
};
|
|
4592
|
-
|
|
4593
|
-
__proto._updateCircularOffset = function () {
|
|
4594
|
-
if (!this._circularEnabled) {
|
|
4595
|
-
this._circularOffset = 0;
|
|
4596
|
-
return;
|
|
4597
|
-
}
|
|
4775
|
+
__proto._refreshVisiblePanels = function () {
|
|
4776
|
+
var _this = this;
|
|
4598
4777
|
|
|
4599
4778
|
var flicking = getFlickingAttached(this._flicking);
|
|
4600
|
-
var
|
|
4601
|
-
|
|
4779
|
+
var panels = flicking.renderer.panels;
|
|
4780
|
+
var newVisiblePanels = panels.filter(function (panel) {
|
|
4781
|
+
return _this.canSee(panel);
|
|
4602
4782
|
});
|
|
4603
|
-
var
|
|
4604
|
-
|
|
4783
|
+
var prevVisiblePanels = this._visiblePanels;
|
|
4784
|
+
this._visiblePanels = newVisiblePanels;
|
|
4785
|
+
var added = newVisiblePanels.filter(function (panel) {
|
|
4786
|
+
return !includes(prevVisiblePanels, panel);
|
|
4605
4787
|
});
|
|
4606
|
-
var
|
|
4607
|
-
return panel
|
|
4788
|
+
var removed = prevVisiblePanels.filter(function (panel) {
|
|
4789
|
+
return !includes(newVisiblePanels, panel);
|
|
4608
4790
|
});
|
|
4609
|
-
this._circularOffset = this._calcPanelAreaSum(toggledPrev) - this._calcPanelAreaSum(toggledNext);
|
|
4610
|
-
};
|
|
4611
|
-
|
|
4612
|
-
return CircularCamera;
|
|
4613
|
-
}(Camera);
|
|
4614
|
-
|
|
4615
|
-
/**
|
|
4616
|
-
* A {@link Camera} that set range not to go out of the first/last panel, so it won't show empty spaces before/after the first/last panel
|
|
4617
|
-
* @ko 첫번째와 마지막 패널 밖으로 넘어가지 못하도록 범위를 설정하여, 첫번째/마지막 패널 전/후의 빈 공간을 보이지 않도록 하는 종류의 {@link Camera}
|
|
4618
|
-
*/
|
|
4619
|
-
|
|
4620
|
-
var BoundCamera =
|
|
4621
|
-
/*#__PURE__*/
|
|
4622
|
-
function (_super) {
|
|
4623
|
-
__extends(BoundCamera, _super);
|
|
4624
|
-
|
|
4625
|
-
function BoundCamera() {
|
|
4626
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4627
|
-
}
|
|
4628
|
-
/**
|
|
4629
|
-
* Update {@link Camera#range range} of Camera
|
|
4630
|
-
* @ko Camera의 {@link Camera#range range}를 업데이트합니다
|
|
4631
|
-
* @chainable
|
|
4632
|
-
* @throws {FlickingError}
|
|
4633
|
-
* {@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} When {@link Camera#init init} is not called before
|
|
4634
|
-
* <ko>{@link ERROR_CODE NOT_ATTACHED_TO_FLICKING} {@link Camera#init init}이 이전에 호출되지 않은 경우</ko>
|
|
4635
|
-
* @return {this}
|
|
4636
|
-
*/
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
var __proto = BoundCamera.prototype;
|
|
4640
|
-
|
|
4641
|
-
__proto.updateRange = function () {
|
|
4642
|
-
var flicking = getFlickingAttached(this._flicking);
|
|
4643
|
-
var renderer = flicking.renderer;
|
|
4644
|
-
var alignPos = this._alignPos;
|
|
4645
|
-
var firstPanel = renderer.getPanel(0);
|
|
4646
|
-
var lastPanel = renderer.getPanel(renderer.panelCount - 1);
|
|
4647
|
-
|
|
4648
|
-
if (!firstPanel || !lastPanel) {
|
|
4649
|
-
this._range = {
|
|
4650
|
-
min: 0,
|
|
4651
|
-
max: 0
|
|
4652
|
-
};
|
|
4653
|
-
return this;
|
|
4654
|
-
}
|
|
4655
|
-
|
|
4656
|
-
var viewportSize = this.size;
|
|
4657
|
-
var firstPanelPrev = firstPanel.range.min;
|
|
4658
|
-
var lastPanelNext = lastPanel.range.max;
|
|
4659
|
-
var panelAreaSize = lastPanelNext - firstPanelPrev;
|
|
4660
|
-
var isBiggerThanViewport = viewportSize < panelAreaSize;
|
|
4661
|
-
var firstPos = firstPanelPrev + alignPos;
|
|
4662
|
-
var lastPos = lastPanelNext - viewportSize + alignPos;
|
|
4663
4791
|
|
|
4664
|
-
if (
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
var pos = firstPos + parseAlign$1(alignVal, lastPos - firstPos);
|
|
4673
|
-
this._range = {
|
|
4674
|
-
min: pos,
|
|
4675
|
-
max: pos
|
|
4676
|
-
};
|
|
4792
|
+
if (added.length > 0 || removed.length > 0) {
|
|
4793
|
+
void flicking.renderer.render().then(function () {
|
|
4794
|
+
flicking.trigger(new ComponentEvent(EVENTS.VISIBLE_CHANGE, {
|
|
4795
|
+
added: added,
|
|
4796
|
+
removed: removed,
|
|
4797
|
+
visiblePanels: newVisiblePanels
|
|
4798
|
+
}));
|
|
4799
|
+
});
|
|
4677
4800
|
}
|
|
4678
|
-
|
|
4679
|
-
return this;
|
|
4680
4801
|
};
|
|
4681
4802
|
|
|
4682
|
-
__proto.
|
|
4683
|
-
var
|
|
4684
|
-
|
|
4803
|
+
__proto._checkNeedPanel = function () {
|
|
4804
|
+
var needPanelTriggered = this._needPanelTriggered;
|
|
4805
|
+
if (needPanelTriggered.prev && needPanelTriggered.next) return;
|
|
4685
4806
|
var flicking = getFlickingAttached(this._flicking);
|
|
4686
4807
|
var panels = flicking.renderer.panels;
|
|
4687
4808
|
|
|
4688
4809
|
if (panels.length <= 0) {
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
var range = this._range;
|
|
4694
|
-
var reachablePanels = panels.filter(function (panel) {
|
|
4695
|
-
return _this.canReach(panel);
|
|
4696
|
-
});
|
|
4697
|
-
|
|
4698
|
-
if (reachablePanels.length > 0) {
|
|
4699
|
-
var shouldPrependBoundAnchor = reachablePanels[0].position !== range.min;
|
|
4700
|
-
var shouldAppendBoundAnchor = reachablePanels[reachablePanels.length - 1].position !== range.max;
|
|
4701
|
-
var indexOffset_1 = shouldPrependBoundAnchor ? 1 : 0;
|
|
4702
|
-
var newAnchors = reachablePanels.map(function (panel, idx) {
|
|
4703
|
-
return new AnchorPoint({
|
|
4704
|
-
index: idx + indexOffset_1,
|
|
4705
|
-
position: panel.position,
|
|
4706
|
-
panel: panel
|
|
4707
|
-
});
|
|
4708
|
-
});
|
|
4709
|
-
|
|
4710
|
-
if (shouldPrependBoundAnchor) {
|
|
4711
|
-
newAnchors.splice(0, 0, new AnchorPoint({
|
|
4712
|
-
index: 0,
|
|
4713
|
-
position: range.min,
|
|
4714
|
-
panel: panels[reachablePanels[0].index - 1]
|
|
4810
|
+
if (!needPanelTriggered.prev) {
|
|
4811
|
+
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4812
|
+
direction: DIRECTION.PREV
|
|
4715
4813
|
}));
|
|
4814
|
+
needPanelTriggered.prev = true;
|
|
4716
4815
|
}
|
|
4717
4816
|
|
|
4718
|
-
if (
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
position: range.max,
|
|
4722
|
-
panel: panels[reachablePanels[reachablePanels.length - 1].index + 1]
|
|
4817
|
+
if (!needPanelTriggered.next) {
|
|
4818
|
+
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4819
|
+
direction: DIRECTION.NEXT
|
|
4723
4820
|
}));
|
|
4821
|
+
needPanelTriggered.next = true;
|
|
4724
4822
|
}
|
|
4725
4823
|
|
|
4726
|
-
|
|
4727
|
-
} else if (range.min !== range.max) {
|
|
4728
|
-
// There're more than 2 panels
|
|
4729
|
-
var nearestPanelAtMin = this._findNearestPanel(range.min, panels);
|
|
4730
|
-
|
|
4731
|
-
var panelAtMin = nearestPanelAtMin.index === panels.length - 1 ? nearestPanelAtMin.prev() : nearestPanelAtMin;
|
|
4732
|
-
var panelAtMax = panelAtMin.next();
|
|
4733
|
-
this._anchors = [new AnchorPoint({
|
|
4734
|
-
index: 0,
|
|
4735
|
-
position: range.min,
|
|
4736
|
-
panel: panelAtMin
|
|
4737
|
-
}), new AnchorPoint({
|
|
4738
|
-
index: 1,
|
|
4739
|
-
position: range.max,
|
|
4740
|
-
panel: panelAtMax
|
|
4741
|
-
})];
|
|
4742
|
-
} else {
|
|
4743
|
-
this._anchors = [new AnchorPoint({
|
|
4744
|
-
index: 0,
|
|
4745
|
-
position: range.min,
|
|
4746
|
-
panel: this._findNearestPanel(range.min, panels)
|
|
4747
|
-
})];
|
|
4824
|
+
return;
|
|
4748
4825
|
}
|
|
4749
4826
|
|
|
4750
|
-
|
|
4751
|
-
|
|
4827
|
+
var cameraPosition = this._position;
|
|
4828
|
+
var cameraSize = this.size;
|
|
4829
|
+
var cameraRange = this._range;
|
|
4830
|
+
var needPanelThreshold = flicking.needPanelThreshold;
|
|
4831
|
+
var cameraPrev = cameraPosition - this._alignPos;
|
|
4832
|
+
var cameraNext = cameraPrev + cameraSize;
|
|
4833
|
+
var firstPanel = panels[0];
|
|
4834
|
+
var lastPanel = panels[panels.length - 1];
|
|
4752
4835
|
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
var anchors = this._anchors;
|
|
4756
|
-
if (anchors.length <= 0) return null;
|
|
4836
|
+
if (!needPanelTriggered.prev) {
|
|
4837
|
+
var firstPanelPrev = firstPanel.range.min;
|
|
4757
4838
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4839
|
+
if (cameraPrev <= firstPanelPrev + needPanelThreshold || cameraPosition <= cameraRange.min + needPanelThreshold) {
|
|
4840
|
+
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4841
|
+
direction: DIRECTION.PREV
|
|
4842
|
+
}));
|
|
4843
|
+
needPanelTriggered.prev = true;
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4847
|
+
if (!needPanelTriggered.next) {
|
|
4848
|
+
var lastPanelNext = lastPanel.range.max;
|
|
4849
|
+
|
|
4850
|
+
if (cameraNext >= lastPanelNext - needPanelThreshold || cameraPosition >= cameraRange.max - needPanelThreshold) {
|
|
4851
|
+
flicking.trigger(new ComponentEvent(EVENTS.NEED_PANEL, {
|
|
4852
|
+
direction: DIRECTION.NEXT
|
|
4853
|
+
}));
|
|
4854
|
+
needPanelTriggered.next = true;
|
|
4855
|
+
}
|
|
4764
4856
|
}
|
|
4765
4857
|
};
|
|
4766
4858
|
|
|
4767
|
-
__proto.
|
|
4768
|
-
var
|
|
4859
|
+
__proto._checkReachEnd = function (prevPos, newPos) {
|
|
4860
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4861
|
+
var range = this._range;
|
|
4862
|
+
var wasBetweenRange = prevPos > range.min && prevPos < range.max;
|
|
4863
|
+
var isBetweenRange = newPos > range.min && newPos < range.max;
|
|
4864
|
+
if (!wasBetweenRange || isBetweenRange) return;
|
|
4865
|
+
var direction = newPos <= range.min ? DIRECTION.PREV : DIRECTION.NEXT;
|
|
4866
|
+
flicking.trigger(new ComponentEvent(EVENTS.REACH_EDGE, {
|
|
4867
|
+
direction: direction
|
|
4868
|
+
}));
|
|
4869
|
+
};
|
|
4769
4870
|
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
var dist = Math.abs(panel.position - pos);
|
|
4871
|
+
__proto._updateMode = function () {
|
|
4872
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4773
4873
|
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
}
|
|
4874
|
+
if (flicking.circular) {
|
|
4875
|
+
var circularMode = new CircularCameraMode(flicking);
|
|
4876
|
+
var canSetCircularMode = circularMode.checkAvailability();
|
|
4778
4877
|
|
|
4779
|
-
|
|
4780
|
-
|
|
4878
|
+
if (canSetCircularMode) {
|
|
4879
|
+
this._mode = circularMode;
|
|
4880
|
+
} else {
|
|
4881
|
+
var fallbackMode = flicking.circularFallback;
|
|
4882
|
+
this._mode = fallbackMode === CIRCULAR_FALLBACK.BOUND ? new BoundCameraMode(flicking) : new LinearCameraMode(flicking);
|
|
4883
|
+
}
|
|
4781
4884
|
|
|
4885
|
+
this._circularEnabled = canSetCircularMode;
|
|
4886
|
+
} else {
|
|
4887
|
+
this._mode = flicking.bound ? new BoundCameraMode(flicking) : new LinearCameraMode(flicking);
|
|
4888
|
+
}
|
|
4889
|
+
};
|
|
4782
4890
|
|
|
4783
|
-
|
|
4891
|
+
__proto._togglePanels = function (prevPos, pos) {
|
|
4892
|
+
if (pos === prevPos) return false;
|
|
4893
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
4894
|
+
var panels = flicking.renderer.panels;
|
|
4895
|
+
var toggled = panels.map(function (panel) {
|
|
4896
|
+
return panel.toggle(prevPos, pos);
|
|
4897
|
+
});
|
|
4898
|
+
return toggled.some(function (isToggled) {
|
|
4899
|
+
return isToggled;
|
|
4900
|
+
});
|
|
4784
4901
|
};
|
|
4785
4902
|
|
|
4786
|
-
return
|
|
4787
|
-
}(
|
|
4903
|
+
return Camera;
|
|
4904
|
+
}();
|
|
4788
4905
|
|
|
4789
4906
|
/**
|
|
4790
4907
|
* A component that manages {@link Panel} and its elements
|
|
@@ -4804,7 +4921,8 @@ function () {
|
|
|
4804
4921
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
4805
4922
|
strategy = _a.strategy;
|
|
4806
4923
|
this._flicking = null;
|
|
4807
|
-
this._panels = [];
|
|
4924
|
+
this._panels = [];
|
|
4925
|
+
this._rendering = false; // Bind options
|
|
4808
4926
|
|
|
4809
4927
|
this._align = align;
|
|
4810
4928
|
this._strategy = strategy;
|
|
@@ -4827,6 +4945,20 @@ function () {
|
|
|
4827
4945
|
enumerable: false,
|
|
4828
4946
|
configurable: true
|
|
4829
4947
|
});
|
|
4948
|
+
Object.defineProperty(__proto, "rendering", {
|
|
4949
|
+
/**
|
|
4950
|
+
* A boolean value indicating whether rendering is in progress
|
|
4951
|
+
* @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
|
|
4952
|
+
* @type {boolean}
|
|
4953
|
+
* @readonly
|
|
4954
|
+
* @internal
|
|
4955
|
+
*/
|
|
4956
|
+
get: function () {
|
|
4957
|
+
return this._rendering;
|
|
4958
|
+
},
|
|
4959
|
+
enumerable: false,
|
|
4960
|
+
configurable: true
|
|
4961
|
+
});
|
|
4830
4962
|
Object.defineProperty(__proto, "panelCount", {
|
|
4831
4963
|
/**
|
|
4832
4964
|
* Count of panels
|
|
@@ -4958,6 +5090,25 @@ function () {
|
|
|
4958
5090
|
|
|
4959
5091
|
|
|
4960
5092
|
__proto.batchInsert = function () {
|
|
5093
|
+
var items = [];
|
|
5094
|
+
|
|
5095
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5096
|
+
items[_i] = arguments[_i];
|
|
5097
|
+
}
|
|
5098
|
+
|
|
5099
|
+
var allPanelsInserted = this.batchInsertDefer.apply(this, __spread(items));
|
|
5100
|
+
if (allPanelsInserted.length <= 0) return [];
|
|
5101
|
+
this.updateAfterPanelChange(allPanelsInserted, []);
|
|
5102
|
+
return allPanelsInserted;
|
|
5103
|
+
};
|
|
5104
|
+
/**
|
|
5105
|
+
* Defers update
|
|
5106
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5107
|
+
* @internal
|
|
5108
|
+
*/
|
|
5109
|
+
|
|
5110
|
+
|
|
5111
|
+
__proto.batchInsertDefer = function () {
|
|
4961
5112
|
var _this = this;
|
|
4962
5113
|
|
|
4963
5114
|
var items = [];
|
|
@@ -4968,7 +5119,6 @@ function () {
|
|
|
4968
5119
|
|
|
4969
5120
|
var panels = this._panels;
|
|
4970
5121
|
var flicking = getFlickingAttached(this._flicking);
|
|
4971
|
-
var control = flicking.control;
|
|
4972
5122
|
var prevFirstPanel = panels[0];
|
|
4973
5123
|
var align = parsePanelAlign(this._align);
|
|
4974
5124
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -4983,7 +5133,7 @@ function () {
|
|
|
4983
5133
|
flicking: flicking
|
|
4984
5134
|
});
|
|
4985
5135
|
});
|
|
4986
|
-
panels.splice.apply(panels,
|
|
5136
|
+
panels.splice.apply(panels, __spread([insertingIdx, 0], panelsInserted));
|
|
4987
5137
|
|
|
4988
5138
|
if (item.hasDOMInElements) {
|
|
4989
5139
|
// Insert the actual elements as camera element's children
|
|
@@ -5006,29 +5156,8 @@ function () {
|
|
|
5006
5156
|
panel.increaseIndex(panelsInserted.length);
|
|
5007
5157
|
panel.updatePosition();
|
|
5008
5158
|
});
|
|
5009
|
-
return
|
|
5159
|
+
return __spread(addedPanels, panelsInserted);
|
|
5010
5160
|
}, []);
|
|
5011
|
-
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
5012
|
-
|
|
5013
|
-
this._updateCameraAndControl();
|
|
5014
|
-
|
|
5015
|
-
void this.render(); // Move to the first panel added if no panels existed
|
|
5016
|
-
// FIXME: fix for animating case
|
|
5017
|
-
|
|
5018
|
-
if (allPanelsInserted.length > 0 && !control.animating) {
|
|
5019
|
-
void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
|
|
5020
|
-
duration: 0
|
|
5021
|
-
}).catch(function () {
|
|
5022
|
-
return void 0;
|
|
5023
|
-
});
|
|
5024
|
-
}
|
|
5025
|
-
|
|
5026
|
-
flicking.camera.updateOffset();
|
|
5027
|
-
flicking.trigger(new ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5028
|
-
added: allPanelsInserted,
|
|
5029
|
-
removed: []
|
|
5030
|
-
}));
|
|
5031
|
-
this.checkPanelContentsReady(allPanelsInserted);
|
|
5032
5161
|
return allPanelsInserted;
|
|
5033
5162
|
};
|
|
5034
5163
|
/**
|
|
@@ -5045,6 +5174,25 @@ function () {
|
|
|
5045
5174
|
|
|
5046
5175
|
|
|
5047
5176
|
__proto.batchRemove = function () {
|
|
5177
|
+
var items = [];
|
|
5178
|
+
|
|
5179
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5180
|
+
items[_i] = arguments[_i];
|
|
5181
|
+
}
|
|
5182
|
+
|
|
5183
|
+
var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread(items));
|
|
5184
|
+
if (allPanelsRemoved.length <= 0) return [];
|
|
5185
|
+
this.updateAfterPanelChange([], allPanelsRemoved);
|
|
5186
|
+
return allPanelsRemoved;
|
|
5187
|
+
};
|
|
5188
|
+
/**
|
|
5189
|
+
* Defers update
|
|
5190
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5191
|
+
* @internal
|
|
5192
|
+
*/
|
|
5193
|
+
|
|
5194
|
+
|
|
5195
|
+
__proto.batchRemoveDefer = function () {
|
|
5048
5196
|
var _this = this;
|
|
5049
5197
|
|
|
5050
5198
|
var items = [];
|
|
@@ -5055,10 +5203,8 @@ function () {
|
|
|
5055
5203
|
|
|
5056
5204
|
var panels = this._panels;
|
|
5057
5205
|
var flicking = getFlickingAttached(this._flicking);
|
|
5058
|
-
var
|
|
5059
|
-
control = flicking.control;
|
|
5206
|
+
var control = flicking.control;
|
|
5060
5207
|
var activePanel = control.activePanel;
|
|
5061
|
-
var activeIndex = control.activeIndex;
|
|
5062
5208
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
5063
5209
|
var index = item.index,
|
|
5064
5210
|
deleteCount = item.deleteCount;
|
|
@@ -5085,34 +5231,62 @@ function () {
|
|
|
5085
5231
|
control.resetActive();
|
|
5086
5232
|
}
|
|
5087
5233
|
|
|
5088
|
-
return
|
|
5089
|
-
}, []);
|
|
5234
|
+
return __spread(removed, panelsRemoved);
|
|
5235
|
+
}, []);
|
|
5236
|
+
return allPanelsRemoved;
|
|
5237
|
+
};
|
|
5238
|
+
/**
|
|
5239
|
+
* @internal
|
|
5240
|
+
*/
|
|
5241
|
+
|
|
5242
|
+
|
|
5243
|
+
__proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
|
|
5244
|
+
var _a;
|
|
5245
|
+
|
|
5246
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5247
|
+
var camera = flicking.camera,
|
|
5248
|
+
control = flicking.control;
|
|
5249
|
+
var panels = this._panels;
|
|
5250
|
+
var activePanel = control.activePanel; // Update camera & control
|
|
5090
5251
|
|
|
5091
5252
|
this._updateCameraAndControl();
|
|
5092
5253
|
|
|
5093
|
-
void this.render();
|
|
5254
|
+
void this.render();
|
|
5094
5255
|
|
|
5095
|
-
if (
|
|
5096
|
-
|
|
5256
|
+
if (!activePanel || activePanel.removed) {
|
|
5257
|
+
if (panels.length <= 0) {
|
|
5258
|
+
// All panels removed
|
|
5259
|
+
camera.lookAt(0);
|
|
5260
|
+
} else {
|
|
5261
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
5262
|
+
|
|
5263
|
+
if (targetIndex > panels.length - 1) {
|
|
5264
|
+
targetIndex = panels.length - 1;
|
|
5265
|
+
}
|
|
5097
5266
|
|
|
5098
|
-
|
|
5099
|
-
void control.moveToPanel(targetPanel, {
|
|
5267
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5100
5268
|
duration: 0
|
|
5101
5269
|
}).catch(function () {
|
|
5102
5270
|
return void 0;
|
|
5103
5271
|
});
|
|
5104
|
-
} else {
|
|
5105
|
-
// All panels removed
|
|
5106
|
-
camera.lookAt(0);
|
|
5107
5272
|
}
|
|
5273
|
+
} else {
|
|
5274
|
+
void control.moveToPanel(control.activePanel, {
|
|
5275
|
+
duration: 0
|
|
5276
|
+
}).catch(function () {
|
|
5277
|
+
return void 0;
|
|
5278
|
+
});
|
|
5108
5279
|
}
|
|
5109
5280
|
|
|
5110
5281
|
flicking.camera.updateOffset();
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5282
|
+
|
|
5283
|
+
if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
|
|
5284
|
+
flicking.trigger(new ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5285
|
+
added: panelsAdded,
|
|
5286
|
+
removed: panelsRemoved
|
|
5287
|
+
}));
|
|
5288
|
+
this.checkPanelContentsReady(__spread(panelsAdded, panelsRemoved));
|
|
5289
|
+
}
|
|
5116
5290
|
};
|
|
5117
5291
|
/**
|
|
5118
5292
|
* @internal
|
|
@@ -5157,6 +5331,7 @@ function () {
|
|
|
5157
5331
|
});
|
|
5158
5332
|
if (!flicking.initialized) return;
|
|
5159
5333
|
camera.updateRange();
|
|
5334
|
+
camera.updateOffset();
|
|
5160
5335
|
camera.updateAnchors();
|
|
5161
5336
|
|
|
5162
5337
|
if (control.animating) ; else {
|
|
@@ -5190,6 +5365,7 @@ function () {
|
|
|
5190
5365
|
var camera = flicking.camera,
|
|
5191
5366
|
control = flicking.control;
|
|
5192
5367
|
camera.updateRange();
|
|
5368
|
+
camera.updateOffset();
|
|
5193
5369
|
camera.updateAnchors();
|
|
5194
5370
|
camera.resetNeedPanelHistory();
|
|
5195
5371
|
control.updateInput();
|
|
@@ -6084,7 +6260,7 @@ function () {
|
|
|
6084
6260
|
var notToggled = renderedPanels.filter(function (panel) {
|
|
6085
6261
|
return !panel.toggled;
|
|
6086
6262
|
});
|
|
6087
|
-
return
|
|
6263
|
+
return __spread(toggledPrev, notToggled, toggledNext).map(function (panel) {
|
|
6088
6264
|
return panel.index;
|
|
6089
6265
|
});
|
|
6090
6266
|
};
|
|
@@ -6294,7 +6470,7 @@ function () {
|
|
|
6294
6470
|
__proto.getRenderingIndexesByOrder = function (flicking) {
|
|
6295
6471
|
var virtualManager = flicking.virtual;
|
|
6296
6472
|
|
|
6297
|
-
var visiblePanels =
|
|
6473
|
+
var visiblePanels = __spread(flicking.visiblePanels).filter(function (panel) {
|
|
6298
6474
|
return panel.rendered;
|
|
6299
6475
|
}).sort(function (panel1, panel2) {
|
|
6300
6476
|
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
@@ -6315,7 +6491,7 @@ function () {
|
|
|
6315
6491
|
}).map(function (el) {
|
|
6316
6492
|
return el.idx;
|
|
6317
6493
|
});
|
|
6318
|
-
return
|
|
6494
|
+
return __spread(visibleIndexes, invisibleIndexes);
|
|
6319
6495
|
};
|
|
6320
6496
|
|
|
6321
6497
|
__proto.getRenderingElementsByOrder = function (flicking) {
|
|
@@ -6424,58 +6600,64 @@ function (_super) {
|
|
|
6424
6600
|
horizontal = _e === void 0 ? true : _e,
|
|
6425
6601
|
_f = _b.circular,
|
|
6426
6602
|
circular = _f === void 0 ? false : _f,
|
|
6427
|
-
_g = _b.
|
|
6428
|
-
|
|
6429
|
-
_h = _b.
|
|
6430
|
-
|
|
6431
|
-
_j = _b.
|
|
6432
|
-
|
|
6433
|
-
_k = _b.
|
|
6434
|
-
|
|
6435
|
-
_l = _b.
|
|
6436
|
-
|
|
6437
|
-
_m = _b.
|
|
6438
|
-
|
|
6439
|
-
_o = _b.
|
|
6440
|
-
|
|
6441
|
-
_p = _b.
|
|
6442
|
-
|
|
6443
|
-
_q = _b.
|
|
6444
|
-
|
|
6445
|
-
_r = _b.
|
|
6446
|
-
|
|
6603
|
+
_g = _b.circularFallback,
|
|
6604
|
+
circularFallback = _g === void 0 ? CIRCULAR_FALLBACK.LINEAR : _g,
|
|
6605
|
+
_h = _b.bound,
|
|
6606
|
+
bound = _h === void 0 ? false : _h,
|
|
6607
|
+
_j = _b.adaptive,
|
|
6608
|
+
adaptive = _j === void 0 ? false : _j,
|
|
6609
|
+
_k = _b.panelsPerView,
|
|
6610
|
+
panelsPerView = _k === void 0 ? -1 : _k,
|
|
6611
|
+
_l = _b.noPanelStyleOverride,
|
|
6612
|
+
noPanelStyleOverride = _l === void 0 ? false : _l,
|
|
6613
|
+
_m = _b.resizeOnContentsReady,
|
|
6614
|
+
resizeOnContentsReady = _m === void 0 ? false : _m,
|
|
6615
|
+
_o = _b.needPanelThreshold,
|
|
6616
|
+
needPanelThreshold = _o === void 0 ? 0 : _o,
|
|
6617
|
+
_p = _b.preventEventsBeforeInit,
|
|
6618
|
+
preventEventsBeforeInit = _p === void 0 ? true : _p,
|
|
6619
|
+
_q = _b.deceleration,
|
|
6620
|
+
deceleration = _q === void 0 ? 0.0075 : _q,
|
|
6621
|
+
_r = _b.duration,
|
|
6622
|
+
duration = _r === void 0 ? 500 : _r,
|
|
6623
|
+
_s = _b.easing,
|
|
6624
|
+
easing = _s === void 0 ? function (x) {
|
|
6447
6625
|
return 1 - Math.pow(1 - x, 3);
|
|
6448
|
-
} :
|
|
6449
|
-
|
|
6450
|
-
inputType =
|
|
6451
|
-
|
|
6452
|
-
moveType =
|
|
6453
|
-
|
|
6454
|
-
threshold =
|
|
6455
|
-
|
|
6456
|
-
interruptable =
|
|
6457
|
-
|
|
6458
|
-
bounce =
|
|
6459
|
-
|
|
6460
|
-
iOSEdgeSwipeThreshold =
|
|
6461
|
-
|
|
6462
|
-
preventClickOnDrag =
|
|
6463
|
-
|
|
6464
|
-
disableOnInit =
|
|
6465
|
-
|
|
6466
|
-
renderOnlyVisible =
|
|
6467
|
-
|
|
6468
|
-
virtual =
|
|
6469
|
-
|
|
6470
|
-
autoInit =
|
|
6471
|
-
|
|
6472
|
-
autoResize =
|
|
6473
|
-
|
|
6474
|
-
useResizeObserver =
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6626
|
+
} : _s,
|
|
6627
|
+
_t = _b.inputType,
|
|
6628
|
+
inputType = _t === void 0 ? ["mouse", "touch"] : _t,
|
|
6629
|
+
_u = _b.moveType,
|
|
6630
|
+
moveType = _u === void 0 ? "snap" : _u,
|
|
6631
|
+
_v = _b.threshold,
|
|
6632
|
+
threshold = _v === void 0 ? 40 : _v,
|
|
6633
|
+
_w = _b.interruptable,
|
|
6634
|
+
interruptable = _w === void 0 ? true : _w,
|
|
6635
|
+
_x = _b.bounce,
|
|
6636
|
+
bounce = _x === void 0 ? "20%" : _x,
|
|
6637
|
+
_y = _b.iOSEdgeSwipeThreshold,
|
|
6638
|
+
iOSEdgeSwipeThreshold = _y === void 0 ? 30 : _y,
|
|
6639
|
+
_z = _b.preventClickOnDrag,
|
|
6640
|
+
preventClickOnDrag = _z === void 0 ? true : _z,
|
|
6641
|
+
_0 = _b.disableOnInit,
|
|
6642
|
+
disableOnInit = _0 === void 0 ? false : _0,
|
|
6643
|
+
_1 = _b.renderOnlyVisible,
|
|
6644
|
+
renderOnlyVisible = _1 === void 0 ? false : _1,
|
|
6645
|
+
_2 = _b.virtual,
|
|
6646
|
+
virtual = _2 === void 0 ? null : _2,
|
|
6647
|
+
_3 = _b.autoInit,
|
|
6648
|
+
autoInit = _3 === void 0 ? true : _3,
|
|
6649
|
+
_4 = _b.autoResize,
|
|
6650
|
+
autoResize = _4 === void 0 ? true : _4,
|
|
6651
|
+
_5 = _b.useResizeObserver,
|
|
6652
|
+
useResizeObserver = _5 === void 0 ? true : _5,
|
|
6653
|
+
_6 = _b.resizeDebounce,
|
|
6654
|
+
resizeDebounce = _6 === void 0 ? 0 : _6,
|
|
6655
|
+
_7 = _b.maxResizeDebounce,
|
|
6656
|
+
maxResizeDebounce = _7 === void 0 ? 100 : _7,
|
|
6657
|
+
_8 = _b.externalRenderer,
|
|
6658
|
+
externalRenderer = _8 === void 0 ? null : _8,
|
|
6659
|
+
_9 = _b.renderExternal,
|
|
6660
|
+
renderExternal = _9 === void 0 ? null : _9;
|
|
6479
6661
|
|
|
6480
6662
|
var _this = _super.call(this) || this; // Internal states
|
|
6481
6663
|
|
|
@@ -6487,6 +6669,7 @@ function (_super) {
|
|
|
6487
6669
|
_this._defaultIndex = defaultIndex;
|
|
6488
6670
|
_this._horizontal = horizontal;
|
|
6489
6671
|
_this._circular = circular;
|
|
6672
|
+
_this._circularFallback = circularFallback;
|
|
6490
6673
|
_this._bound = bound;
|
|
6491
6674
|
_this._adaptive = adaptive;
|
|
6492
6675
|
_this._panelsPerView = panelsPerView;
|
|
@@ -6510,6 +6693,8 @@ function (_super) {
|
|
|
6510
6693
|
_this._autoInit = autoInit;
|
|
6511
6694
|
_this._autoResize = autoResize;
|
|
6512
6695
|
_this._useResizeObserver = useResizeObserver;
|
|
6696
|
+
_this._resizeDebounce = resizeDebounce;
|
|
6697
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
6513
6698
|
_this._externalRenderer = externalRenderer;
|
|
6514
6699
|
_this._renderExternal = renderExternal; // Create core components
|
|
6515
6700
|
|
|
@@ -6625,7 +6810,7 @@ function (_super) {
|
|
|
6625
6810
|
* @readonly
|
|
6626
6811
|
*/
|
|
6627
6812
|
get: function () {
|
|
6628
|
-
return this._camera.
|
|
6813
|
+
return this._camera.circularEnabled;
|
|
6629
6814
|
},
|
|
6630
6815
|
enumerable: false,
|
|
6631
6816
|
configurable: true
|
|
@@ -6859,6 +7044,24 @@ function (_super) {
|
|
|
6859
7044
|
enumerable: false,
|
|
6860
7045
|
configurable: true
|
|
6861
7046
|
});
|
|
7047
|
+
Object.defineProperty(__proto, "circularFallback", {
|
|
7048
|
+
/**
|
|
7049
|
+
* Set panel control mode for the case when circular cannot be enabled.
|
|
7050
|
+
* "linear" will set the view's range from the top of the first panel to the top of the last panel.
|
|
7051
|
+
* "bound" will prevent the view from going out of the first/last panel, so it won't show empty spaces before/after the first/last panel.
|
|
7052
|
+
* @ko 순환 모드 사용 불가능시 사용할 패널 조작 범위 설정 방식을 변경합니다.
|
|
7053
|
+
* "linear" 사용시 시점이 첫번째 엘리먼트 위에서부터 마지막 엘리먼트 위까지 움직일 수 있도록 설정합니다.
|
|
7054
|
+
* "bound" 사용시 시점이 첫번째 엘리먼트와 마지막 엘리먼트의 끝과 끝 사이에서 움직일 수 있도록 설정합니다.
|
|
7055
|
+
* @see CIRCULAR_FALLBACK
|
|
7056
|
+
* @type {string}
|
|
7057
|
+
* @default "linear"
|
|
7058
|
+
*/
|
|
7059
|
+
get: function () {
|
|
7060
|
+
return this._circularFallback;
|
|
7061
|
+
},
|
|
7062
|
+
enumerable: false,
|
|
7063
|
+
configurable: true
|
|
7064
|
+
});
|
|
6862
7065
|
Object.defineProperty(__proto, "bound", {
|
|
6863
7066
|
/**
|
|
6864
7067
|
* Prevent the view(camera element) from going out of the first/last panel, so it won't show empty spaces before/after the first/last panel
|
|
@@ -7340,6 +7543,38 @@ function (_super) {
|
|
|
7340
7543
|
enumerable: false,
|
|
7341
7544
|
configurable: true
|
|
7342
7545
|
});
|
|
7546
|
+
Object.defineProperty(__proto, "resizeDebounce", {
|
|
7547
|
+
/**
|
|
7548
|
+
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
7549
|
+
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
7550
|
+
* This can increase performance by preventing `resize` being called too often.
|
|
7551
|
+
* @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
|
|
7552
|
+
* 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
|
|
7553
|
+
* 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
|
|
7554
|
+
* @type {number}
|
|
7555
|
+
* @default 0
|
|
7556
|
+
*/
|
|
7557
|
+
get: function () {
|
|
7558
|
+
return this._resizeDebounce;
|
|
7559
|
+
},
|
|
7560
|
+
enumerable: false,
|
|
7561
|
+
configurable: true
|
|
7562
|
+
});
|
|
7563
|
+
Object.defineProperty(__proto, "maxResizeDebounce", {
|
|
7564
|
+
/**
|
|
7565
|
+
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
7566
|
+
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
7567
|
+
* @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
|
|
7568
|
+
* 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
|
|
7569
|
+
* @type {number}
|
|
7570
|
+
* @default 100
|
|
7571
|
+
*/
|
|
7572
|
+
get: function () {
|
|
7573
|
+
return this._maxResizeDebounce;
|
|
7574
|
+
},
|
|
7575
|
+
enumerable: false,
|
|
7576
|
+
configurable: true
|
|
7577
|
+
});
|
|
7343
7578
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
7344
7579
|
/**
|
|
7345
7580
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -7375,85 +7610,61 @@ function (_super) {
|
|
|
7375
7610
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
7376
7611
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
7377
7612
|
* @fires Flicking#ready
|
|
7378
|
-
* @return {
|
|
7613
|
+
* @return {Promise<void>}
|
|
7379
7614
|
*/
|
|
7380
7615
|
|
|
7381
7616
|
__proto.init = function () {
|
|
7382
|
-
|
|
7383
|
-
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
7384
|
-
|
|
7385
|
-
var _this = this;
|
|
7386
|
-
|
|
7387
|
-
return __generator(this, function (_a) {
|
|
7388
|
-
switch (_a.label) {
|
|
7389
|
-
case 0:
|
|
7390
|
-
if (this._initialized) return [2
|
|
7391
|
-
/*return*/
|
|
7392
|
-
];
|
|
7393
|
-
camera = this._camera;
|
|
7394
|
-
renderer = this._renderer;
|
|
7395
|
-
control = this._control;
|
|
7396
|
-
virtualManager = this._virtualManager;
|
|
7397
|
-
originalTrigger = this.trigger;
|
|
7398
|
-
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7399
|
-
camera.init(this);
|
|
7400
|
-
virtualManager.init();
|
|
7401
|
-
renderer.init(this);
|
|
7402
|
-
control.init(this);
|
|
7403
|
-
|
|
7404
|
-
if (preventEventsBeforeInit) {
|
|
7405
|
-
this.trigger = function () {
|
|
7406
|
-
return _this;
|
|
7407
|
-
};
|
|
7408
|
-
}
|
|
7409
|
-
|
|
7410
|
-
return [4
|
|
7411
|
-
/*yield*/
|
|
7412
|
-
, this.resize()];
|
|
7413
|
-
|
|
7414
|
-
case 1:
|
|
7415
|
-
_a.sent(); // Look at initial panel
|
|
7416
|
-
|
|
7617
|
+
var _this = this;
|
|
7417
7618
|
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7619
|
+
if (this._initialized) return Promise.resolve();
|
|
7620
|
+
var camera = this._camera;
|
|
7621
|
+
var renderer = this._renderer;
|
|
7622
|
+
var control = this._control;
|
|
7623
|
+
var virtualManager = this._virtualManager;
|
|
7624
|
+
var originalTrigger = this.trigger;
|
|
7625
|
+
var preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7626
|
+
camera.init();
|
|
7627
|
+
virtualManager.init();
|
|
7628
|
+
renderer.init(this);
|
|
7629
|
+
control.init(this);
|
|
7630
|
+
|
|
7631
|
+
if (preventEventsBeforeInit) {
|
|
7632
|
+
this.trigger = function () {
|
|
7633
|
+
return _this;
|
|
7634
|
+
};
|
|
7635
|
+
}
|
|
7421
7636
|
|
|
7422
|
-
|
|
7423
|
-
// Look at initial panel
|
|
7424
|
-
_a.sent();
|
|
7637
|
+
this._initialResize(); // Look at initial panel
|
|
7425
7638
|
|
|
7426
|
-
if (this._autoResize) {
|
|
7427
|
-
this._autoResizer.enable();
|
|
7428
|
-
}
|
|
7429
7639
|
|
|
7430
|
-
|
|
7431
|
-
control.controller.addPreventClickHandler();
|
|
7432
|
-
}
|
|
7640
|
+
this._moveToInitialPanel();
|
|
7433
7641
|
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7642
|
+
if (this._autoResize) {
|
|
7643
|
+
this._autoResizer.enable();
|
|
7644
|
+
}
|
|
7437
7645
|
|
|
7438
|
-
|
|
7646
|
+
if (this._preventClickOnDrag) {
|
|
7647
|
+
control.controller.addPreventClickHandler();
|
|
7648
|
+
}
|
|
7439
7649
|
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7650
|
+
if (this._disableOnInit) {
|
|
7651
|
+
this.disableInput();
|
|
7652
|
+
}
|
|
7443
7653
|
|
|
7654
|
+
renderer.checkPanelContentsReady(renderer.panels);
|
|
7655
|
+
return renderer.render().then(function () {
|
|
7656
|
+
// Done initializing & emit ready event
|
|
7657
|
+
_this._plugins.forEach(function (plugin) {
|
|
7658
|
+
return plugin.init(_this);
|
|
7659
|
+
});
|
|
7444
7660
|
|
|
7445
|
-
|
|
7661
|
+
_this._initialized = true;
|
|
7446
7662
|
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7663
|
+
if (preventEventsBeforeInit) {
|
|
7664
|
+
_this.trigger = originalTrigger;
|
|
7665
|
+
}
|
|
7450
7666
|
|
|
7451
|
-
|
|
7452
|
-
return [2
|
|
7453
|
-
/*return*/
|
|
7454
|
-
];
|
|
7455
|
-
}
|
|
7456
|
-
});
|
|
7667
|
+
_this.trigger(new ComponentEvent(EVENTS.READY));
|
|
7457
7668
|
});
|
|
7458
7669
|
};
|
|
7459
7670
|
/**
|
|
@@ -7819,7 +8030,7 @@ function (_super) {
|
|
|
7819
8030
|
});
|
|
7820
8031
|
}
|
|
7821
8032
|
|
|
7822
|
-
(_a = this._plugins).push.apply(_a,
|
|
8033
|
+
(_a = this._plugins).push.apply(_a, __spread(plugins));
|
|
7823
8034
|
|
|
7824
8035
|
return this;
|
|
7825
8036
|
};
|
|
@@ -8066,22 +8277,14 @@ function (_super) {
|
|
|
8066
8277
|
};
|
|
8067
8278
|
|
|
8068
8279
|
__proto._createCamera = function () {
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
if (this._circular) {
|
|
8074
|
-
if (this._bound) {
|
|
8075
|
-
// eslint-disable-next-line no-console
|
|
8076
|
-
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
8077
|
-
}
|
|
8078
|
-
|
|
8079
|
-
return new CircularCamera(cameraOption);
|
|
8080
|
-
} else if (this._bound) {
|
|
8081
|
-
return new BoundCamera(cameraOption);
|
|
8082
|
-
} else {
|
|
8083
|
-
return new LinearCamera(cameraOption);
|
|
8280
|
+
if (this._circular && this._bound) {
|
|
8281
|
+
// eslint-disable-next-line no-console
|
|
8282
|
+
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
8084
8283
|
}
|
|
8284
|
+
|
|
8285
|
+
return new Camera(this, {
|
|
8286
|
+
align: this._align
|
|
8287
|
+
});
|
|
8085
8288
|
};
|
|
8086
8289
|
|
|
8087
8290
|
__proto._createRenderer = function () {
|
|
@@ -8115,23 +8318,59 @@ function (_super) {
|
|
|
8115
8318
|
};
|
|
8116
8319
|
|
|
8117
8320
|
__proto._moveToInitialPanel = function () {
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
}
|
|
8321
|
+
var renderer = this._renderer;
|
|
8322
|
+
var control = this._control;
|
|
8323
|
+
var camera = this._camera;
|
|
8324
|
+
var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
8325
|
+
if (!initialPanel) return;
|
|
8326
|
+
var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
|
|
8327
|
+
control.setActive(initialPanel, null, false);
|
|
8328
|
+
|
|
8329
|
+
if (!nearestAnchor) {
|
|
8330
|
+
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
|
|
8331
|
+
}
|
|
8332
|
+
|
|
8333
|
+
var position = initialPanel.position;
|
|
8334
|
+
|
|
8335
|
+
if (!camera.canReach(initialPanel)) {
|
|
8336
|
+
position = nearestAnchor.position;
|
|
8337
|
+
}
|
|
8338
|
+
|
|
8339
|
+
camera.lookAt(position);
|
|
8340
|
+
control.updateInput();
|
|
8341
|
+
camera.updateOffset();
|
|
8342
|
+
};
|
|
8343
|
+
|
|
8344
|
+
__proto._initialResize = function () {
|
|
8345
|
+
var viewport = this._viewport;
|
|
8346
|
+
var renderer = this._renderer;
|
|
8347
|
+
var camera = this._camera;
|
|
8348
|
+
var control = this._control;
|
|
8349
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
8350
|
+
width: 0,
|
|
8351
|
+
height: 0,
|
|
8352
|
+
element: viewport.element
|
|
8353
|
+
}));
|
|
8354
|
+
viewport.resize();
|
|
8355
|
+
renderer.updatePanelSize();
|
|
8356
|
+
camera.updateAlignPos();
|
|
8357
|
+
camera.updateRange();
|
|
8358
|
+
camera.updateAnchors();
|
|
8359
|
+
camera.updateOffset();
|
|
8360
|
+
control.updateInput();
|
|
8361
|
+
var newWidth = viewport.width;
|
|
8362
|
+
var newHeight = viewport.height;
|
|
8363
|
+
var sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
8364
|
+
this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
8365
|
+
width: viewport.width,
|
|
8366
|
+
height: viewport.height,
|
|
8367
|
+
prev: {
|
|
8368
|
+
width: 0,
|
|
8369
|
+
height: 0
|
|
8370
|
+
},
|
|
8371
|
+
sizeChanged: sizeChanged,
|
|
8372
|
+
element: viewport.element
|
|
8373
|
+
}));
|
|
8135
8374
|
};
|
|
8136
8375
|
/**
|
|
8137
8376
|
* Version info string
|
|
@@ -8145,7 +8384,7 @@ function (_super) {
|
|
|
8145
8384
|
*/
|
|
8146
8385
|
|
|
8147
8386
|
|
|
8148
|
-
Flicking.VERSION = "4.
|
|
8387
|
+
Flicking.VERSION = "4.6.0";
|
|
8149
8388
|
return Flicking;
|
|
8150
8389
|
}(Component);
|
|
8151
8390
|
|
|
@@ -8168,7 +8407,7 @@ function (_super) {
|
|
|
8168
8407
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
8169
8408
|
[Component.prototype, Flicking.prototype].forEach(function (proto) {
|
|
8170
8409
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
8171
|
-
return !prototype[name] &&
|
|
8410
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
8172
8411
|
}).forEach(function (name) {
|
|
8173
8412
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
8174
8413
|
|
|
@@ -8184,7 +8423,7 @@ var withFlickingMethods = function (prototype, flickingName) {
|
|
|
8184
8423
|
args[_i] = arguments[_i];
|
|
8185
8424
|
}
|
|
8186
8425
|
|
|
8187
|
-
return (_a = descriptor.value).call.apply(_a,
|
|
8426
|
+
return (_a = descriptor.value).call.apply(_a, __spread([this[flickingName]], args));
|
|
8188
8427
|
}
|
|
8189
8428
|
});
|
|
8190
8429
|
} else {
|
|
@@ -8194,7 +8433,8 @@ var withFlickingMethods = function (prototype, flickingName) {
|
|
|
8194
8433
|
getterDescriptor.get = function () {
|
|
8195
8434
|
var _a;
|
|
8196
8435
|
|
|
8197
|
-
|
|
8436
|
+
var flicking = this[flickingName];
|
|
8437
|
+
return flicking && ((_a = descriptor.get) === null || _a === void 0 ? void 0 : _a.call(flicking));
|
|
8198
8438
|
};
|
|
8199
8439
|
}
|
|
8200
8440
|
|
|
@@ -8208,7 +8448,7 @@ var withFlickingMethods = function (prototype, flickingName) {
|
|
|
8208
8448
|
args[_i] = arguments[_i];
|
|
8209
8449
|
}
|
|
8210
8450
|
|
|
8211
|
-
return (_a = descriptor.set) === null || _a === void 0 ? void 0 : _a.call.apply(_a,
|
|
8451
|
+
return (_a = descriptor.set) === null || _a === void 0 ? void 0 : _a.call.apply(_a, __spread([this[flickingName]], args));
|
|
8212
8452
|
};
|
|
8213
8453
|
}
|
|
8214
8454
|
|
|
@@ -8222,7 +8462,10 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8222
8462
|
var renderer = flicking.renderer;
|
|
8223
8463
|
var panels = renderer.panels;
|
|
8224
8464
|
|
|
8225
|
-
var prevList =
|
|
8465
|
+
var prevList = __spread(diffResult.prevList);
|
|
8466
|
+
|
|
8467
|
+
var added = [];
|
|
8468
|
+
var removed = [];
|
|
8226
8469
|
|
|
8227
8470
|
if (diffResult.removed.length > 0) {
|
|
8228
8471
|
var endIdx_1 = -1;
|
|
@@ -8233,7 +8476,7 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8233
8476
|
}
|
|
8234
8477
|
|
|
8235
8478
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
8236
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8479
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8237
8480
|
endIdx_1 = removedIdx;
|
|
8238
8481
|
prevIdx_1 = removedIdx;
|
|
8239
8482
|
} else {
|
|
@@ -8242,39 +8485,34 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8242
8485
|
|
|
8243
8486
|
prevList.splice(removedIdx, 1);
|
|
8244
8487
|
});
|
|
8245
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8488
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8246
8489
|
}
|
|
8247
8490
|
|
|
8248
8491
|
diffResult.ordered.forEach(function (_a) {
|
|
8249
8492
|
var _b = __read(_a, 2),
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
var prevPanel = panels[prevIdx];
|
|
8254
|
-
var indexDiff = newIdx - prevIdx;
|
|
8255
|
-
|
|
8256
|
-
if (indexDiff > 0) {
|
|
8257
|
-
var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
|
|
8258
|
-
prevPanel.increaseIndex(indexDiff);
|
|
8259
|
-
middlePanels.forEach(function (panel) {
|
|
8260
|
-
return panel.decreaseIndex(1);
|
|
8261
|
-
});
|
|
8262
|
-
} else {
|
|
8263
|
-
var middlePanels = panels.slice(newIdx, prevIdx);
|
|
8264
|
-
prevPanel.decreaseIndex(-indexDiff);
|
|
8265
|
-
middlePanels.forEach(function (panel) {
|
|
8266
|
-
return panel.increaseIndex(1);
|
|
8267
|
-
});
|
|
8268
|
-
} // Update position
|
|
8493
|
+
from = _b[0],
|
|
8494
|
+
to = _b[1];
|
|
8269
8495
|
|
|
8270
|
-
|
|
8271
|
-
|
|
8496
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
8497
|
+
panels.splice(to, 0, prevPanel);
|
|
8272
8498
|
});
|
|
8273
8499
|
|
|
8274
8500
|
if (diffResult.ordered.length > 0) {
|
|
8501
|
+
panels.forEach(function (panel, idx) {
|
|
8502
|
+
var indexDiff = idx - panel.index;
|
|
8503
|
+
|
|
8504
|
+
if (indexDiff > 0) {
|
|
8505
|
+
panel.increaseIndex(indexDiff);
|
|
8506
|
+
} else {
|
|
8507
|
+
panel.decreaseIndex(-indexDiff);
|
|
8508
|
+
}
|
|
8509
|
+
});
|
|
8275
8510
|
panels.sort(function (panel1, panel2) {
|
|
8276
8511
|
return panel1.index - panel2.index;
|
|
8277
8512
|
});
|
|
8513
|
+
panels.forEach(function (panel) {
|
|
8514
|
+
panel.updatePosition();
|
|
8515
|
+
});
|
|
8278
8516
|
}
|
|
8279
8517
|
|
|
8280
8518
|
if (diffResult.added.length > 0) {
|
|
@@ -8287,7 +8525,7 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8287
8525
|
}
|
|
8288
8526
|
|
|
8289
8527
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
8290
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
8528
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
|
|
8291
8529
|
startIdx_1 = -1;
|
|
8292
8530
|
prevIdx_2 = -1;
|
|
8293
8531
|
} else {
|
|
@@ -8296,24 +8534,26 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8296
8534
|
});
|
|
8297
8535
|
|
|
8298
8536
|
if (startIdx_1 >= 0) {
|
|
8299
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
8537
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
8300
8538
|
}
|
|
8301
8539
|
}
|
|
8540
|
+
|
|
8541
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8302
8542
|
});
|
|
8303
8543
|
|
|
8304
8544
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
8305
|
-
renderer.
|
|
8545
|
+
return renderer.batchInsertDefer.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
8306
8546
|
return {
|
|
8307
8547
|
index: index,
|
|
8308
8548
|
elements: [addedElements[elIdx]],
|
|
8309
8549
|
hasDOMInElements: false
|
|
8310
8550
|
};
|
|
8311
|
-
})))
|
|
8551
|
+
})));
|
|
8312
8552
|
};
|
|
8313
8553
|
|
|
8314
8554
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
8315
8555
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
8316
|
-
renderer.
|
|
8556
|
+
return renderer.batchRemoveDefer({
|
|
8317
8557
|
index: startIdx,
|
|
8318
8558
|
deleteCount: removed.length,
|
|
8319
8559
|
hasDOMInElements: false
|
|
@@ -8333,16 +8573,16 @@ var getRenderingPanels = (function (flicking, diffResult) {
|
|
|
8333
8573
|
map[prev] = current;
|
|
8334
8574
|
return map;
|
|
8335
8575
|
}, {});
|
|
8336
|
-
return
|
|
8576
|
+
return __spread(flicking.panels.filter(function (panel) {
|
|
8337
8577
|
return !removedPanels[panel.index];
|
|
8338
8578
|
}) // Sort panels by position
|
|
8339
8579
|
.sort(function (panel1, panel2) {
|
|
8340
8580
|
return panel1.position + panel1.offset - (panel2.position + panel2.offset);
|
|
8341
8581
|
}).map(function (panel) {
|
|
8342
8582
|
return diffResult.list[maintainedMap[panel.index]];
|
|
8343
|
-
})
|
|
8583
|
+
}), diffResult.added.map(function (idx) {
|
|
8344
8584
|
return diffResult.list[idx];
|
|
8345
|
-
}))
|
|
8585
|
+
}));
|
|
8346
8586
|
});
|
|
8347
8587
|
|
|
8348
8588
|
var getDefaultCameraTransform = (function (align, horizontal, firstPanelSize) {
|
|
@@ -8396,5 +8636,5 @@ var parseAlign = function (alignVal) {
|
|
|
8396
8636
|
* egjs projects are licensed under the MIT license
|
|
8397
8637
|
*/
|
|
8398
8638
|
|
|
8399
|
-
export { ALIGN, AnchorPoint, AnimatingState, AxesController,
|
|
8639
|
+
export { ALIGN, AnchorPoint, AnimatingState, AxesController, BoundCameraMode, CIRCULAR_FALLBACK, CLASS, Camera, CircularCameraMode, Control, DIRECTION, DisabledState, DraggingState, CODE as ERROR_CODE, EVENTS, ExternalRenderer, FlickingError, FreeControl, HoldingState, IdleState, LinearCameraMode, MOVE_TYPE, NormalRenderingStrategy, Panel, Renderer, SnapControl, State, StateMachine, StrictControl, VanillaElementProvider, VanillaRenderer, Viewport, VirtualElementProvider, VirtualManager, VirtualPanel, VirtualRenderingStrategy, checkExistence, circulateIndex, circulatePosition, clamp, Flicking as default, find, findIndex, findRight, getDefaultCameraTransform, getDirection, getElement, getFlickingAttached, getMinusCompensatedIndex, getProgress, getRenderingPanels, getStyle, includes, isBetween, isString, merge, parseAlign$1 as parseAlign, parseArithmeticExpression, parseArithmeticSize, parseBounce, parseCSSSizeValue, parseElement, parsePanelAlign, range, setPrototypeOf, setSize, sync, toArray, withFlickingMethods };
|
|
8400
8640
|
//# sourceMappingURL=flicking.esm.js.map
|