@egjs/flicking 4.5.1 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TODO.md +3 -0
- package/declaration/Flicking.d.ts +8 -1
- package/declaration/camera/Camera.d.ts +2 -2
- package/declaration/control/Control.d.ts +1 -1
- 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/dist/flicking-inline.css +45 -2
- package/dist/flicking-inline.min.css +1 -0
- package/dist/flicking.css +44 -2
- package/dist/flicking.esm.js +416 -289
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +416 -289
- package/dist/flicking.js.map +1 -1
- package/dist/flicking.min.css +1 -0
- package/dist/flicking.min.js +2 -2
- package/dist/flicking.min.js.map +1 -1
- package/dist/flicking.pkgd.js +416 -289
- 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 +13 -4
- package/sass/flicking-inline.sass +30 -0
- package/sass/flicking.sass +23 -0
- package/src/Flicking.ts +102 -21
- package/src/camera/Camera.ts +10 -14
- package/src/cfc/sync.ts +31 -23
- package/src/cfc/withFlickingMethods.ts +1 -1
- package/src/control/Control.ts +2 -2
- package/src/control/FreeControl.ts +1 -1
- package/src/control/SnapControl.ts +1 -1
- package/src/control/StrictControl.ts +1 -1
- package/src/control/states/AnimatingState.ts +4 -1
- package/src/control/states/DraggingState.ts +7 -2
- package/src/core/AutoResizer.ts +33 -0
- package/src/core/ResizeWatcher.ts +133 -0
- package/src/renderer/Renderer.ts +95 -44
- package/css/flicking-inline.css +0 -38
- package/css/flicking.css +0 -28
- package/dist/flicking-inline.css.map +0 -1
- package/dist/flicking.css.map +0 -1
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.2
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -969,6 +969,33 @@ function () {
|
|
|
969
969
|
var _this = this;
|
|
970
970
|
|
|
971
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;
|
|
972
999
|
void _this._flicking.resize();
|
|
973
1000
|
}; // eslint-disable-next-line @typescript-eslint/member-ordering
|
|
974
1001
|
|
|
@@ -988,6 +1015,8 @@ function () {
|
|
|
988
1015
|
this._flicking = flicking;
|
|
989
1016
|
this._enabled = false;
|
|
990
1017
|
this._resizeObserver = null;
|
|
1018
|
+
this._resizeTimer = -1;
|
|
1019
|
+
this._maxResizeDebounceTimer = -1;
|
|
991
1020
|
}
|
|
992
1021
|
|
|
993
1022
|
var __proto = AutoResizer.prototype;
|
|
@@ -1839,6 +1868,8 @@ function (_super) {
|
|
|
1839
1868
|
};
|
|
1840
1869
|
|
|
1841
1870
|
__proto.onRelease = function (ctx) {
|
|
1871
|
+
var _a;
|
|
1872
|
+
|
|
1842
1873
|
var flicking = ctx.flicking,
|
|
1843
1874
|
axesEvent = ctx.axesEvent,
|
|
1844
1875
|
transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
|
|
@@ -1858,7 +1889,13 @@ function (_super) {
|
|
|
1858
1889
|
var control = flicking.control;
|
|
1859
1890
|
var position = axesEvent.destPos[POSITION_KEY];
|
|
1860
1891
|
var duration = Math.max(axesEvent.duration, flicking.duration);
|
|
1861
|
-
|
|
1892
|
+
|
|
1893
|
+
try {
|
|
1894
|
+
void control.moveToPosition(position, duration, axesEvent);
|
|
1895
|
+
} catch (err) {
|
|
1896
|
+
transitTo(STATE_TYPE.IDLE);
|
|
1897
|
+
axesEvent.setTo((_a = {}, _a[POSITION_KEY] = flicking.camera.position, _a), 0);
|
|
1898
|
+
}
|
|
1862
1899
|
};
|
|
1863
1900
|
|
|
1864
1901
|
return DraggingState;
|
|
@@ -1934,7 +1971,11 @@ function (_super) {
|
|
|
1934
1971
|
direction: getDirection(animatingContext.start, animatingContext.end),
|
|
1935
1972
|
axesEvent: axesEvent
|
|
1936
1973
|
}));
|
|
1937
|
-
|
|
1974
|
+
var targetPanel = this._targetPanel;
|
|
1975
|
+
|
|
1976
|
+
if (targetPanel) {
|
|
1977
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
1978
|
+
}
|
|
1938
1979
|
};
|
|
1939
1980
|
|
|
1940
1981
|
return AnimatingState;
|
|
@@ -2689,7 +2730,7 @@ function () {
|
|
|
2689
2730
|
*/
|
|
2690
2731
|
|
|
2691
2732
|
|
|
2692
|
-
__proto.updatePosition = function (
|
|
2733
|
+
__proto.updatePosition = function (progressInPanel) {
|
|
2693
2734
|
var flicking = getFlickingAttached(this._flicking);
|
|
2694
2735
|
var camera = flicking.camera;
|
|
2695
2736
|
var activePanel = this._activePanel;
|
|
@@ -3065,48 +3106,41 @@ function (_super) {
|
|
|
3065
3106
|
*/
|
|
3066
3107
|
|
|
3067
3108
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
activeAnchor = camera.findActiveAnchor();
|
|
3074
|
-
anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3075
|
-
state = flicking.control.controller.state;
|
|
3109
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3110
|
+
var camera = flicking.camera;
|
|
3111
|
+
var activeAnchor = camera.findActiveAnchor();
|
|
3112
|
+
var anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3113
|
+
var state = flicking.control.controller.state;
|
|
3076
3114
|
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3081
|
-
}
|
|
3115
|
+
if (!activeAnchor || !anchorAtCamera) {
|
|
3116
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3117
|
+
}
|
|
3082
3118
|
|
|
3083
|
-
|
|
3084
|
-
posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3085
|
-
absPosDelta = Math.abs(posDelta);
|
|
3086
|
-
snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3087
|
-
|
|
3088
|
-
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3089
|
-
// Move to anchor at position
|
|
3090
|
-
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3091
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3092
|
-
// Move to the adjacent panel
|
|
3093
|
-
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3094
|
-
} else {
|
|
3095
|
-
// Restore to active panel
|
|
3096
|
-
targetAnchor = anchorAtCamera;
|
|
3097
|
-
}
|
|
3119
|
+
var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
|
|
3098
3120
|
|
|
3099
|
-
|
|
3121
|
+
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3122
|
+
var absPosDelta = Math.abs(posDelta);
|
|
3123
|
+
var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3124
|
+
var targetAnchor;
|
|
3100
3125
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3126
|
+
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3127
|
+
// Move to anchor at position
|
|
3128
|
+
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3129
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3130
|
+
// Move to the adjacent panel
|
|
3131
|
+
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3132
|
+
} else {
|
|
3133
|
+
// Restore to active panel
|
|
3134
|
+
targetAnchor = anchorAtCamera;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
|
|
3138
|
+
|
|
3139
|
+
return this._animateToPosition({
|
|
3140
|
+
position: camera.clampToReachablePosition(targetAnchor.position),
|
|
3141
|
+
duration: duration,
|
|
3142
|
+
newActivePanel: targetAnchor.panel,
|
|
3143
|
+
axesEvent: axesEvent
|
|
3110
3144
|
});
|
|
3111
3145
|
};
|
|
3112
3146
|
|
|
@@ -3295,35 +3329,26 @@ function (_super) {
|
|
|
3295
3329
|
|
|
3296
3330
|
|
|
3297
3331
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
camera = flicking.camera;
|
|
3303
|
-
targetPos = camera.clampToReachablePosition(position);
|
|
3304
|
-
anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3332
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3333
|
+
var camera = flicking.camera;
|
|
3334
|
+
var targetPos = camera.clampToReachablePosition(position);
|
|
3335
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3305
3336
|
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3310
|
-
}
|
|
3337
|
+
if (!anchorAtPosition) {
|
|
3338
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3339
|
+
}
|
|
3311
3340
|
|
|
3312
|
-
|
|
3341
|
+
var targetPanel = anchorAtPosition.panel; // Trigger only change event
|
|
3313
3342
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3343
|
+
if (targetPanel !== this._activePanel) {
|
|
3344
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3345
|
+
}
|
|
3317
3346
|
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
newActivePanel: targetPanel,
|
|
3324
|
-
axesEvent: axesEvent
|
|
3325
|
-
})];
|
|
3326
|
-
});
|
|
3347
|
+
return this._animateToPosition({
|
|
3348
|
+
position: this._stopAtEdge ? targetPos : position,
|
|
3349
|
+
duration: duration,
|
|
3350
|
+
newActivePanel: targetPanel,
|
|
3351
|
+
axesEvent: axesEvent
|
|
3327
3352
|
});
|
|
3328
3353
|
};
|
|
3329
3354
|
|
|
@@ -3521,62 +3546,56 @@ function (_super) {
|
|
|
3521
3546
|
|
|
3522
3547
|
|
|
3523
3548
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
cameraRange = camera.range;
|
|
3533
|
-
clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3534
|
-
anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3535
|
-
|
|
3536
|
-
if (!anchorAtPosition || !activePanel) {
|
|
3537
|
-
return [2
|
|
3538
|
-
/*return*/
|
|
3539
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3540
|
-
}
|
|
3549
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3550
|
+
var camera = flicking.camera;
|
|
3551
|
+
var activePanel = this._activePanel;
|
|
3552
|
+
var axesRange = this._controller.range;
|
|
3553
|
+
var indexRange = this._indexRange;
|
|
3554
|
+
var cameraRange = camera.range;
|
|
3555
|
+
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3556
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3541
3557
|
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3558
|
+
if (!anchorAtPosition || !activePanel) {
|
|
3559
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
var prevPos = activePanel.position;
|
|
3563
|
+
var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
|
|
3564
|
+
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
3565
|
+
var targetPos;
|
|
3566
|
+
var targetPanel;
|
|
3567
|
+
var anchors = camera.anchorPoints;
|
|
3568
|
+
var firstAnchor = anchors[0];
|
|
3569
|
+
var lastAnchor = anchors[anchors.length - 1];
|
|
3570
|
+
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3571
|
+
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3572
|
+
|
|
3573
|
+
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3574
|
+
// In bounce area
|
|
3575
|
+
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3576
|
+
targetPanel = targetAnchor.panel;
|
|
3577
|
+
targetPos = targetAnchor.position;
|
|
3578
|
+
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
3579
|
+
// Move to anchor at position
|
|
3580
|
+
targetPanel = anchorAtPosition.panel;
|
|
3581
|
+
targetPos = anchorAtPosition.position;
|
|
3582
|
+
} else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
|
|
3583
|
+
// Move to adjacent anchor
|
|
3584
|
+
targetPanel = adjacentAnchor.panel;
|
|
3585
|
+
targetPos = adjacentAnchor.position;
|
|
3586
|
+
} else {
|
|
3587
|
+
// Restore to active panel
|
|
3588
|
+
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
3589
|
+
targetPanel = activePanel;
|
|
3590
|
+
}
|
|
3568
3591
|
|
|
3569
|
-
|
|
3592
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3570
3593
|
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
newActivePanel: targetPanel,
|
|
3577
|
-
axesEvent: axesEvent
|
|
3578
|
-
})];
|
|
3579
|
-
});
|
|
3594
|
+
return this._animateToPosition({
|
|
3595
|
+
position: targetPos,
|
|
3596
|
+
duration: duration,
|
|
3597
|
+
newActivePanel: targetPanel,
|
|
3598
|
+
axesEvent: axesEvent
|
|
3580
3599
|
});
|
|
3581
3600
|
};
|
|
3582
3601
|
|
|
@@ -4038,7 +4057,7 @@ var Camera =
|
|
|
4038
4057
|
/*#__PURE__*/
|
|
4039
4058
|
function () {
|
|
4040
4059
|
/** */
|
|
4041
|
-
function Camera(_a) {
|
|
4060
|
+
function Camera(flicking, _a) {
|
|
4042
4061
|
var _this = this;
|
|
4043
4062
|
|
|
4044
4063
|
var _b = (_a === void 0 ? {} : _a).align,
|
|
@@ -4078,7 +4097,7 @@ function () {
|
|
|
4078
4097
|
_this._transform = transformName;
|
|
4079
4098
|
};
|
|
4080
4099
|
|
|
4081
|
-
this._flicking =
|
|
4100
|
+
this._flicking = flicking;
|
|
4082
4101
|
|
|
4083
4102
|
this._resetInternalValues(); // Options
|
|
4084
4103
|
|
|
@@ -4373,17 +4392,14 @@ function () {
|
|
|
4373
4392
|
/**
|
|
4374
4393
|
* Initialize Camera
|
|
4375
4394
|
* @ko Camera를 초기화합니다
|
|
4376
|
-
* @param {Flicking} flicking An instance of {@link Flicking}<ko>Flicking의 인스턴스</ko>
|
|
4377
|
-
* @chainable
|
|
4378
4395
|
* @throws {FlickingError}
|
|
4379
4396
|
* {@link ERROR_CODE VAL_MUST_NOT_NULL} If the camera element(`.flicking-camera`) does not exist inside viewport element
|
|
4380
4397
|
* <ko>{@link ERROR_CODE VAL_MUST_NOT_NULL} 뷰포트 엘리먼트 내부에 카메라 엘리먼트(`.flicking-camera`)가 존재하지 않을 경우</ko>
|
|
4381
4398
|
* @return {this}
|
|
4382
4399
|
*/
|
|
4383
4400
|
|
|
4384
|
-
__proto.init = function (
|
|
4385
|
-
this._flicking
|
|
4386
|
-
var viewportEl = flicking.viewport.element;
|
|
4401
|
+
__proto.init = function () {
|
|
4402
|
+
var viewportEl = this._flicking.viewport.element;
|
|
4387
4403
|
checkExistence(viewportEl.firstElementChild, "First element child of the viewport element");
|
|
4388
4404
|
this._el = viewportEl.firstElementChild;
|
|
4389
4405
|
|
|
@@ -4401,8 +4417,6 @@ function () {
|
|
|
4401
4417
|
|
|
4402
4418
|
|
|
4403
4419
|
__proto.destroy = function () {
|
|
4404
|
-
this._flicking = null;
|
|
4405
|
-
|
|
4406
4420
|
this._resetInternalValues();
|
|
4407
4421
|
|
|
4408
4422
|
return this;
|
|
@@ -4433,12 +4447,12 @@ function () {
|
|
|
4433
4447
|
|
|
4434
4448
|
this._checkReachEnd(prevPos, pos);
|
|
4435
4449
|
|
|
4436
|
-
this.applyTransform();
|
|
4437
|
-
|
|
4438
4450
|
if (toggled) {
|
|
4439
4451
|
void flicking.renderer.render().then(function () {
|
|
4440
4452
|
_this.updateOffset();
|
|
4441
4453
|
});
|
|
4454
|
+
} else {
|
|
4455
|
+
this.applyTransform();
|
|
4442
4456
|
}
|
|
4443
4457
|
};
|
|
4444
4458
|
/**
|
|
@@ -4625,7 +4639,6 @@ function () {
|
|
|
4625
4639
|
});
|
|
4626
4640
|
}
|
|
4627
4641
|
|
|
4628
|
-
this.updateOffset();
|
|
4629
4642
|
return this;
|
|
4630
4643
|
};
|
|
4631
4644
|
/**
|
|
@@ -4717,7 +4730,6 @@ function () {
|
|
|
4717
4730
|
/**
|
|
4718
4731
|
* Apply "transform" style with the current position to camera element
|
|
4719
4732
|
* @ko 현재 위치를 기준으로한 transform 스타일을 카메라 엘리먼트에 적용합니다.
|
|
4720
|
-
* @chainable
|
|
4721
4733
|
* @return {this}
|
|
4722
4734
|
*/
|
|
4723
4735
|
|
|
@@ -4725,6 +4737,8 @@ function () {
|
|
|
4725
4737
|
__proto.applyTransform = function () {
|
|
4726
4738
|
var el = this._el;
|
|
4727
4739
|
var flicking = getFlickingAttached(this._flicking);
|
|
4740
|
+
var renderer = flicking.renderer;
|
|
4741
|
+
if (renderer.rendering) return this;
|
|
4728
4742
|
var actualPosition = this._position - this._alignPos - this._offset + this._circularOffset;
|
|
4729
4743
|
el.style[this._transform] = flicking.horizontal ? "translate(" + -actualPosition + "px)" : "translate(0, " + -actualPosition + "px)";
|
|
4730
4744
|
return this;
|
|
@@ -4897,7 +4911,8 @@ function () {
|
|
|
4897
4911
|
align = _b === void 0 ? ALIGN.CENTER : _b,
|
|
4898
4912
|
strategy = _a.strategy;
|
|
4899
4913
|
this._flicking = null;
|
|
4900
|
-
this._panels = [];
|
|
4914
|
+
this._panels = [];
|
|
4915
|
+
this._rendering = false; // Bind options
|
|
4901
4916
|
|
|
4902
4917
|
this._align = align;
|
|
4903
4918
|
this._strategy = strategy;
|
|
@@ -4920,6 +4935,20 @@ function () {
|
|
|
4920
4935
|
enumerable: false,
|
|
4921
4936
|
configurable: true
|
|
4922
4937
|
});
|
|
4938
|
+
Object.defineProperty(__proto, "rendering", {
|
|
4939
|
+
/**
|
|
4940
|
+
* A boolean value indicating whether rendering is in progress
|
|
4941
|
+
* @ko 현재 렌더링이 시작되어 끝나기 전까지의 상태인지의 여부
|
|
4942
|
+
* @type {boolean}
|
|
4943
|
+
* @readonly
|
|
4944
|
+
* @internal
|
|
4945
|
+
*/
|
|
4946
|
+
get: function () {
|
|
4947
|
+
return this._rendering;
|
|
4948
|
+
},
|
|
4949
|
+
enumerable: false,
|
|
4950
|
+
configurable: true
|
|
4951
|
+
});
|
|
4923
4952
|
Object.defineProperty(__proto, "panelCount", {
|
|
4924
4953
|
/**
|
|
4925
4954
|
* Count of panels
|
|
@@ -5051,6 +5080,25 @@ function () {
|
|
|
5051
5080
|
|
|
5052
5081
|
|
|
5053
5082
|
__proto.batchInsert = function () {
|
|
5083
|
+
var items = [];
|
|
5084
|
+
|
|
5085
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5086
|
+
items[_i] = arguments[_i];
|
|
5087
|
+
}
|
|
5088
|
+
|
|
5089
|
+
var allPanelsInserted = this.batchInsertDefer.apply(this, __spread(items));
|
|
5090
|
+
if (allPanelsInserted.length <= 0) return [];
|
|
5091
|
+
this.updateAfterPanelChange(allPanelsInserted, []);
|
|
5092
|
+
return allPanelsInserted;
|
|
5093
|
+
};
|
|
5094
|
+
/**
|
|
5095
|
+
* Defers update
|
|
5096
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5097
|
+
* @internal
|
|
5098
|
+
*/
|
|
5099
|
+
|
|
5100
|
+
|
|
5101
|
+
__proto.batchInsertDefer = function () {
|
|
5054
5102
|
var _this = this;
|
|
5055
5103
|
|
|
5056
5104
|
var items = [];
|
|
@@ -5061,7 +5109,6 @@ function () {
|
|
|
5061
5109
|
|
|
5062
5110
|
var panels = this._panels;
|
|
5063
5111
|
var flicking = getFlickingAttached(this._flicking);
|
|
5064
|
-
var control = flicking.control;
|
|
5065
5112
|
var prevFirstPanel = panels[0];
|
|
5066
5113
|
var align = parsePanelAlign(this._align);
|
|
5067
5114
|
var allPanelsInserted = items.reduce(function (addedPanels, item) {
|
|
@@ -5101,27 +5148,6 @@ function () {
|
|
|
5101
5148
|
});
|
|
5102
5149
|
return __spread(addedPanels, panelsInserted);
|
|
5103
5150
|
}, []);
|
|
5104
|
-
if (allPanelsInserted.length <= 0) return []; // Update camera & control
|
|
5105
|
-
|
|
5106
|
-
this._updateCameraAndControl();
|
|
5107
|
-
|
|
5108
|
-
void this.render(); // Move to the first panel added if no panels existed
|
|
5109
|
-
// FIXME: fix for animating case
|
|
5110
|
-
|
|
5111
|
-
if (allPanelsInserted.length > 0 && !control.animating) {
|
|
5112
|
-
void control.moveToPanel(control.activePanel || allPanelsInserted[0], {
|
|
5113
|
-
duration: 0
|
|
5114
|
-
}).catch(function () {
|
|
5115
|
-
return void 0;
|
|
5116
|
-
});
|
|
5117
|
-
}
|
|
5118
|
-
|
|
5119
|
-
flicking.camera.updateOffset();
|
|
5120
|
-
flicking.trigger(new ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5121
|
-
added: allPanelsInserted,
|
|
5122
|
-
removed: []
|
|
5123
|
-
}));
|
|
5124
|
-
this.checkPanelContentsReady(allPanelsInserted);
|
|
5125
5151
|
return allPanelsInserted;
|
|
5126
5152
|
};
|
|
5127
5153
|
/**
|
|
@@ -5138,6 +5164,25 @@ function () {
|
|
|
5138
5164
|
|
|
5139
5165
|
|
|
5140
5166
|
__proto.batchRemove = function () {
|
|
5167
|
+
var items = [];
|
|
5168
|
+
|
|
5169
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5170
|
+
items[_i] = arguments[_i];
|
|
5171
|
+
}
|
|
5172
|
+
|
|
5173
|
+
var allPanelsRemoved = this.batchRemoveDefer.apply(this, __spread(items));
|
|
5174
|
+
if (allPanelsRemoved.length <= 0) return [];
|
|
5175
|
+
this.updateAfterPanelChange([], allPanelsRemoved);
|
|
5176
|
+
return allPanelsRemoved;
|
|
5177
|
+
};
|
|
5178
|
+
/**
|
|
5179
|
+
* Defers update
|
|
5180
|
+
* camera position & others will be updated after calling updateAfterPanelChange
|
|
5181
|
+
* @internal
|
|
5182
|
+
*/
|
|
5183
|
+
|
|
5184
|
+
|
|
5185
|
+
__proto.batchRemoveDefer = function () {
|
|
5141
5186
|
var _this = this;
|
|
5142
5187
|
|
|
5143
5188
|
var items = [];
|
|
@@ -5148,10 +5193,8 @@ function () {
|
|
|
5148
5193
|
|
|
5149
5194
|
var panels = this._panels;
|
|
5150
5195
|
var flicking = getFlickingAttached(this._flicking);
|
|
5151
|
-
var
|
|
5152
|
-
control = flicking.control;
|
|
5196
|
+
var control = flicking.control;
|
|
5153
5197
|
var activePanel = control.activePanel;
|
|
5154
|
-
var activeIndex = control.activeIndex;
|
|
5155
5198
|
var allPanelsRemoved = items.reduce(function (removed, item) {
|
|
5156
5199
|
var index = item.index,
|
|
5157
5200
|
deleteCount = item.deleteCount;
|
|
@@ -5179,33 +5222,63 @@ function () {
|
|
|
5179
5222
|
}
|
|
5180
5223
|
|
|
5181
5224
|
return __spread(removed, panelsRemoved);
|
|
5182
|
-
}, []);
|
|
5225
|
+
}, []);
|
|
5226
|
+
return allPanelsRemoved;
|
|
5227
|
+
};
|
|
5228
|
+
/**
|
|
5229
|
+
* @internal
|
|
5230
|
+
*/
|
|
5231
|
+
|
|
5232
|
+
|
|
5233
|
+
__proto.updateAfterPanelChange = function (panelsAdded, panelsRemoved) {
|
|
5234
|
+
var _a;
|
|
5235
|
+
|
|
5236
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
5237
|
+
var camera = flicking.camera,
|
|
5238
|
+
control = flicking.control;
|
|
5239
|
+
var panels = this._panels;
|
|
5240
|
+
var activePanel = control.activePanel; // Update camera & control
|
|
5183
5241
|
|
|
5184
5242
|
this._updateCameraAndControl();
|
|
5185
5243
|
|
|
5186
|
-
void this.render();
|
|
5244
|
+
void this.render();
|
|
5245
|
+
|
|
5246
|
+
if (!flicking.animating) {
|
|
5247
|
+
if (!activePanel || activePanel.removed) {
|
|
5248
|
+
if (panels.length <= 0) {
|
|
5249
|
+
// All panels removed
|
|
5250
|
+
camera.lookAt(0);
|
|
5251
|
+
} else {
|
|
5252
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
5187
5253
|
|
|
5188
|
-
|
|
5189
|
-
|
|
5254
|
+
if (targetIndex > panels.length - 1) {
|
|
5255
|
+
targetIndex = panels.length - 1;
|
|
5256
|
+
}
|
|
5190
5257
|
|
|
5191
|
-
|
|
5192
|
-
|
|
5258
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5259
|
+
duration: 0
|
|
5260
|
+
}).catch(function () {
|
|
5261
|
+
return void 0;
|
|
5262
|
+
});
|
|
5263
|
+
}
|
|
5264
|
+
} else {
|
|
5265
|
+
void control.moveToPanel(activePanel, {
|
|
5193
5266
|
duration: 0
|
|
5194
5267
|
}).catch(function () {
|
|
5195
5268
|
return void 0;
|
|
5196
5269
|
});
|
|
5197
|
-
} else {
|
|
5198
|
-
// All panels removed
|
|
5199
|
-
camera.lookAt(0);
|
|
5200
5270
|
}
|
|
5201
5271
|
}
|
|
5202
5272
|
|
|
5203
5273
|
flicking.camera.updateOffset();
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5274
|
+
|
|
5275
|
+
if (panelsAdded.length > 0 || panelsRemoved.length > 0) {
|
|
5276
|
+
flicking.trigger(new ComponentEvent(EVENTS.PANEL_CHANGE, {
|
|
5277
|
+
added: panelsAdded,
|
|
5278
|
+
removed: panelsRemoved
|
|
5279
|
+
}));
|
|
5280
|
+
this.checkPanelContentsReady(__spread(panelsAdded, panelsRemoved));
|
|
5281
|
+
}
|
|
5209
5282
|
};
|
|
5210
5283
|
/**
|
|
5211
5284
|
* @internal
|
|
@@ -5250,6 +5323,7 @@ function () {
|
|
|
5250
5323
|
});
|
|
5251
5324
|
if (!flicking.initialized) return;
|
|
5252
5325
|
camera.updateRange();
|
|
5326
|
+
camera.updateOffset();
|
|
5253
5327
|
camera.updateAnchors();
|
|
5254
5328
|
|
|
5255
5329
|
if (control.animating) ; else {
|
|
@@ -5283,6 +5357,7 @@ function () {
|
|
|
5283
5357
|
var camera = flicking.camera,
|
|
5284
5358
|
control = flicking.control;
|
|
5285
5359
|
camera.updateRange();
|
|
5360
|
+
camera.updateOffset();
|
|
5286
5361
|
camera.updateAnchors();
|
|
5287
5362
|
camera.resetNeedPanelHistory();
|
|
5288
5363
|
control.updateInput();
|
|
@@ -6567,10 +6642,14 @@ function (_super) {
|
|
|
6567
6642
|
autoResize = _4 === void 0 ? true : _4,
|
|
6568
6643
|
_5 = _b.useResizeObserver,
|
|
6569
6644
|
useResizeObserver = _5 === void 0 ? true : _5,
|
|
6570
|
-
_6 = _b.
|
|
6571
|
-
|
|
6572
|
-
_7 = _b.
|
|
6573
|
-
|
|
6645
|
+
_6 = _b.resizeDebounce,
|
|
6646
|
+
resizeDebounce = _6 === void 0 ? 0 : _6,
|
|
6647
|
+
_7 = _b.maxResizeDebounce,
|
|
6648
|
+
maxResizeDebounce = _7 === void 0 ? 100 : _7,
|
|
6649
|
+
_8 = _b.externalRenderer,
|
|
6650
|
+
externalRenderer = _8 === void 0 ? null : _8,
|
|
6651
|
+
_9 = _b.renderExternal,
|
|
6652
|
+
renderExternal = _9 === void 0 ? null : _9;
|
|
6574
6653
|
|
|
6575
6654
|
var _this = _super.call(this) || this; // Internal states
|
|
6576
6655
|
|
|
@@ -6606,6 +6685,8 @@ function (_super) {
|
|
|
6606
6685
|
_this._autoInit = autoInit;
|
|
6607
6686
|
_this._autoResize = autoResize;
|
|
6608
6687
|
_this._useResizeObserver = useResizeObserver;
|
|
6688
|
+
_this._resizeDebounce = resizeDebounce;
|
|
6689
|
+
_this._maxResizeDebounce = maxResizeDebounce;
|
|
6609
6690
|
_this._externalRenderer = externalRenderer;
|
|
6610
6691
|
_this._renderExternal = renderExternal; // Create core components
|
|
6611
6692
|
|
|
@@ -7454,6 +7535,38 @@ function (_super) {
|
|
|
7454
7535
|
enumerable: false,
|
|
7455
7536
|
configurable: true
|
|
7456
7537
|
});
|
|
7538
|
+
Object.defineProperty(__proto, "resizeDebounce", {
|
|
7539
|
+
/**
|
|
7540
|
+
* Delays size recalculation from `autoResize` by the given time in milisecond.
|
|
7541
|
+
* If the size is changed again while being delayed, it cancels the previous one and delays from the beginning again.
|
|
7542
|
+
* This can increase performance by preventing `resize` being called too often.
|
|
7543
|
+
* @ko `autoResize` 설정시에 호출되는 크기 재계산을 주어진 시간(단위: ms)만큼 지연시킵니다.
|
|
7544
|
+
* 지연시키는 도중 크기가 다시 변경되었을 경우, 이전 것을 취소하고 주어진 시간만큼 다시 지연시킵니다.
|
|
7545
|
+
* 이를 통해 `resize`가 너무 많이 호출되는 것을 방지하여 성능을 향상시킬 수 있습니다.
|
|
7546
|
+
* @type {number}
|
|
7547
|
+
* @default 0
|
|
7548
|
+
*/
|
|
7549
|
+
get: function () {
|
|
7550
|
+
return this._resizeDebounce;
|
|
7551
|
+
},
|
|
7552
|
+
enumerable: false,
|
|
7553
|
+
configurable: true
|
|
7554
|
+
});
|
|
7555
|
+
Object.defineProperty(__proto, "maxResizeDebounce", {
|
|
7556
|
+
/**
|
|
7557
|
+
* The maximum time for size recalculation delay when using `resizeDebounce`, in milisecond.
|
|
7558
|
+
* This guarantees that size recalculation is performed at least once every (n)ms.
|
|
7559
|
+
* @ko `resizeDebounce` 사용시에 크기 재계산이 지연되는 최대 시간을 지정합니다. (단위: ms)
|
|
7560
|
+
* 이를 통해, 적어도 (n)ms에 한번은 크기 재계산을 수행하는 것을 보장할 수 있습니다.
|
|
7561
|
+
* @type {number}
|
|
7562
|
+
* @default 100
|
|
7563
|
+
*/
|
|
7564
|
+
get: function () {
|
|
7565
|
+
return this._maxResizeDebounce;
|
|
7566
|
+
},
|
|
7567
|
+
enumerable: false,
|
|
7568
|
+
configurable: true
|
|
7569
|
+
});
|
|
7457
7570
|
Object.defineProperty(__proto, "externalRenderer", {
|
|
7458
7571
|
/**
|
|
7459
7572
|
* This is an option for the frameworks(React, Vue, Angular, ...). Don't set it as it's automatically managed by Flicking.
|
|
@@ -7489,85 +7602,61 @@ function (_super) {
|
|
|
7489
7602
|
* @ko Flicking을 초기화하고, 디폴트 인덱스로 이동합니다
|
|
7490
7603
|
* 이 메소드는 `autoInit` 옵션이 true(default)일 경우 Flicking이 생성될 때 자동으로 호출됩니다
|
|
7491
7604
|
* @fires Flicking#ready
|
|
7492
|
-
* @return {
|
|
7605
|
+
* @return {Promise<void>}
|
|
7493
7606
|
*/
|
|
7494
7607
|
|
|
7495
7608
|
__proto.init = function () {
|
|
7496
|
-
|
|
7497
|
-
var camera, renderer, control, virtualManager, originalTrigger, preventEventsBeforeInit;
|
|
7498
|
-
|
|
7499
|
-
var _this = this;
|
|
7500
|
-
|
|
7501
|
-
return __generator(this, function (_a) {
|
|
7502
|
-
switch (_a.label) {
|
|
7503
|
-
case 0:
|
|
7504
|
-
if (this._initialized) return [2
|
|
7505
|
-
/*return*/
|
|
7506
|
-
];
|
|
7507
|
-
camera = this._camera;
|
|
7508
|
-
renderer = this._renderer;
|
|
7509
|
-
control = this._control;
|
|
7510
|
-
virtualManager = this._virtualManager;
|
|
7511
|
-
originalTrigger = this.trigger;
|
|
7512
|
-
preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7513
|
-
camera.init(this);
|
|
7514
|
-
virtualManager.init();
|
|
7515
|
-
renderer.init(this);
|
|
7516
|
-
control.init(this);
|
|
7517
|
-
|
|
7518
|
-
if (preventEventsBeforeInit) {
|
|
7519
|
-
this.trigger = function () {
|
|
7520
|
-
return _this;
|
|
7521
|
-
};
|
|
7522
|
-
}
|
|
7523
|
-
|
|
7524
|
-
return [4
|
|
7525
|
-
/*yield*/
|
|
7526
|
-
, this.resize()];
|
|
7527
|
-
|
|
7528
|
-
case 1:
|
|
7529
|
-
_a.sent(); // Look at initial panel
|
|
7530
|
-
|
|
7609
|
+
var _this = this;
|
|
7531
7610
|
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7611
|
+
if (this._initialized) return Promise.resolve();
|
|
7612
|
+
var camera = this._camera;
|
|
7613
|
+
var renderer = this._renderer;
|
|
7614
|
+
var control = this._control;
|
|
7615
|
+
var virtualManager = this._virtualManager;
|
|
7616
|
+
var originalTrigger = this.trigger;
|
|
7617
|
+
var preventEventsBeforeInit = this._preventEventsBeforeInit;
|
|
7618
|
+
camera.init();
|
|
7619
|
+
virtualManager.init();
|
|
7620
|
+
renderer.init(this);
|
|
7621
|
+
control.init(this);
|
|
7622
|
+
|
|
7623
|
+
if (preventEventsBeforeInit) {
|
|
7624
|
+
this.trigger = function () {
|
|
7625
|
+
return _this;
|
|
7626
|
+
};
|
|
7627
|
+
}
|
|
7535
7628
|
|
|
7536
|
-
|
|
7537
|
-
// Look at initial panel
|
|
7538
|
-
_a.sent();
|
|
7629
|
+
this._initialResize(); // Look at initial panel
|
|
7539
7630
|
|
|
7540
|
-
if (this._autoResize) {
|
|
7541
|
-
this._autoResizer.enable();
|
|
7542
|
-
}
|
|
7543
7631
|
|
|
7544
|
-
|
|
7545
|
-
control.controller.addPreventClickHandler();
|
|
7546
|
-
}
|
|
7632
|
+
this._moveToInitialPanel();
|
|
7547
7633
|
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7634
|
+
if (this._autoResize) {
|
|
7635
|
+
this._autoResizer.enable();
|
|
7636
|
+
}
|
|
7551
7637
|
|
|
7552
|
-
|
|
7638
|
+
if (this._preventClickOnDrag) {
|
|
7639
|
+
control.controller.addPreventClickHandler();
|
|
7640
|
+
}
|
|
7553
7641
|
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7642
|
+
if (this._disableOnInit) {
|
|
7643
|
+
this.disableInput();
|
|
7644
|
+
}
|
|
7557
7645
|
|
|
7646
|
+
renderer.checkPanelContentsReady(renderer.panels);
|
|
7647
|
+
return renderer.render().then(function () {
|
|
7648
|
+
// Done initializing & emit ready event
|
|
7649
|
+
_this._plugins.forEach(function (plugin) {
|
|
7650
|
+
return plugin.init(_this);
|
|
7651
|
+
});
|
|
7558
7652
|
|
|
7559
|
-
|
|
7653
|
+
_this._initialized = true;
|
|
7560
7654
|
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7655
|
+
if (preventEventsBeforeInit) {
|
|
7656
|
+
_this.trigger = originalTrigger;
|
|
7657
|
+
}
|
|
7564
7658
|
|
|
7565
|
-
|
|
7566
|
-
return [2
|
|
7567
|
-
/*return*/
|
|
7568
|
-
];
|
|
7569
|
-
}
|
|
7570
|
-
});
|
|
7659
|
+
_this.trigger(new ComponentEvent(EVENTS.READY));
|
|
7571
7660
|
});
|
|
7572
7661
|
};
|
|
7573
7662
|
/**
|
|
@@ -8185,7 +8274,7 @@ function (_super) {
|
|
|
8185
8274
|
console.warn("\"circular\" and \"bound\" option cannot be used together, ignoring bound.");
|
|
8186
8275
|
}
|
|
8187
8276
|
|
|
8188
|
-
return new Camera({
|
|
8277
|
+
return new Camera(this, {
|
|
8189
8278
|
align: this._align
|
|
8190
8279
|
});
|
|
8191
8280
|
};
|
|
@@ -8221,23 +8310,59 @@ function (_super) {
|
|
|
8221
8310
|
};
|
|
8222
8311
|
|
|
8223
8312
|
__proto._moveToInitialPanel = function () {
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
}
|
|
8313
|
+
var renderer = this._renderer;
|
|
8314
|
+
var control = this._control;
|
|
8315
|
+
var camera = this._camera;
|
|
8316
|
+
var initialPanel = renderer.getPanel(this._defaultIndex) || renderer.getPanel(0);
|
|
8317
|
+
if (!initialPanel) return;
|
|
8318
|
+
var nearestAnchor = camera.findNearestAnchor(initialPanel.position);
|
|
8319
|
+
control.setActive(initialPanel, null, false);
|
|
8320
|
+
|
|
8321
|
+
if (!nearestAnchor) {
|
|
8322
|
+
throw new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(initialPanel.position), CODE.POSITION_NOT_REACHABLE);
|
|
8323
|
+
}
|
|
8324
|
+
|
|
8325
|
+
var position = initialPanel.position;
|
|
8326
|
+
|
|
8327
|
+
if (!camera.canReach(initialPanel)) {
|
|
8328
|
+
position = nearestAnchor.position;
|
|
8329
|
+
}
|
|
8330
|
+
|
|
8331
|
+
camera.lookAt(position);
|
|
8332
|
+
control.updateInput();
|
|
8333
|
+
camera.updateOffset();
|
|
8334
|
+
};
|
|
8335
|
+
|
|
8336
|
+
__proto._initialResize = function () {
|
|
8337
|
+
var viewport = this._viewport;
|
|
8338
|
+
var renderer = this._renderer;
|
|
8339
|
+
var camera = this._camera;
|
|
8340
|
+
var control = this._control;
|
|
8341
|
+
this.trigger(new ComponentEvent(EVENTS.BEFORE_RESIZE, {
|
|
8342
|
+
width: 0,
|
|
8343
|
+
height: 0,
|
|
8344
|
+
element: viewport.element
|
|
8345
|
+
}));
|
|
8346
|
+
viewport.resize();
|
|
8347
|
+
renderer.updatePanelSize();
|
|
8348
|
+
camera.updateAlignPos();
|
|
8349
|
+
camera.updateRange();
|
|
8350
|
+
camera.updateAnchors();
|
|
8351
|
+
camera.updateOffset();
|
|
8352
|
+
control.updateInput();
|
|
8353
|
+
var newWidth = viewport.width;
|
|
8354
|
+
var newHeight = viewport.height;
|
|
8355
|
+
var sizeChanged = newWidth !== 0 || newHeight !== 0;
|
|
8356
|
+
this.trigger(new ComponentEvent(EVENTS.AFTER_RESIZE, {
|
|
8357
|
+
width: viewport.width,
|
|
8358
|
+
height: viewport.height,
|
|
8359
|
+
prev: {
|
|
8360
|
+
width: 0,
|
|
8361
|
+
height: 0
|
|
8362
|
+
},
|
|
8363
|
+
sizeChanged: sizeChanged,
|
|
8364
|
+
element: viewport.element
|
|
8365
|
+
}));
|
|
8241
8366
|
};
|
|
8242
8367
|
/**
|
|
8243
8368
|
* Version info string
|
|
@@ -8251,7 +8376,7 @@ function (_super) {
|
|
|
8251
8376
|
*/
|
|
8252
8377
|
|
|
8253
8378
|
|
|
8254
|
-
Flicking.VERSION = "4.
|
|
8379
|
+
Flicking.VERSION = "4.6.2";
|
|
8255
8380
|
return Flicking;
|
|
8256
8381
|
}(Component);
|
|
8257
8382
|
|
|
@@ -8274,7 +8399,7 @@ function (_super) {
|
|
|
8274
8399
|
var withFlickingMethods = function (prototype, flickingName) {
|
|
8275
8400
|
[Component.prototype, Flicking.prototype].forEach(function (proto) {
|
|
8276
8401
|
Object.getOwnPropertyNames(proto).filter(function (name) {
|
|
8277
|
-
return !prototype[name] &&
|
|
8402
|
+
return !prototype[name] && name.indexOf("_") !== 0 && name !== "constructor";
|
|
8278
8403
|
}).forEach(function (name) {
|
|
8279
8404
|
var descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
8280
8405
|
|
|
@@ -8331,6 +8456,9 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8331
8456
|
|
|
8332
8457
|
var prevList = __spread(diffResult.prevList);
|
|
8333
8458
|
|
|
8459
|
+
var added = [];
|
|
8460
|
+
var removed = [];
|
|
8461
|
+
|
|
8334
8462
|
if (diffResult.removed.length > 0) {
|
|
8335
8463
|
var endIdx_1 = -1;
|
|
8336
8464
|
var prevIdx_1 = -1;
|
|
@@ -8340,7 +8468,7 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8340
8468
|
}
|
|
8341
8469
|
|
|
8342
8470
|
if (prevIdx_1 >= 0 && removedIdx !== prevIdx_1 - 1) {
|
|
8343
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8471
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8344
8472
|
endIdx_1 = removedIdx;
|
|
8345
8473
|
prevIdx_1 = removedIdx;
|
|
8346
8474
|
} else {
|
|
@@ -8349,39 +8477,34 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8349
8477
|
|
|
8350
8478
|
prevList.splice(removedIdx, 1);
|
|
8351
8479
|
});
|
|
8352
|
-
batchRemove(renderer, prevIdx_1, endIdx_1 + 1);
|
|
8480
|
+
removed.push.apply(removed, __spread(batchRemove(renderer, prevIdx_1, endIdx_1 + 1)));
|
|
8353
8481
|
}
|
|
8354
8482
|
|
|
8355
8483
|
diffResult.ordered.forEach(function (_a) {
|
|
8356
8484
|
var _b = __read(_a, 2),
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
var prevPanel = panels[prevIdx];
|
|
8361
|
-
var indexDiff = newIdx - prevIdx;
|
|
8362
|
-
|
|
8363
|
-
if (indexDiff > 0) {
|
|
8364
|
-
var middlePanels = panels.slice(prevIdx + 1, newIdx + 1);
|
|
8365
|
-
prevPanel.increaseIndex(indexDiff);
|
|
8366
|
-
middlePanels.forEach(function (panel) {
|
|
8367
|
-
return panel.decreaseIndex(1);
|
|
8368
|
-
});
|
|
8369
|
-
} else {
|
|
8370
|
-
var middlePanels = panels.slice(newIdx, prevIdx);
|
|
8371
|
-
prevPanel.decreaseIndex(-indexDiff);
|
|
8372
|
-
middlePanels.forEach(function (panel) {
|
|
8373
|
-
return panel.increaseIndex(1);
|
|
8374
|
-
});
|
|
8375
|
-
} // Update position
|
|
8485
|
+
from = _b[0],
|
|
8486
|
+
to = _b[1];
|
|
8376
8487
|
|
|
8377
|
-
|
|
8378
|
-
|
|
8488
|
+
var prevPanel = panels.splice(from, 1)[0];
|
|
8489
|
+
panels.splice(to, 0, prevPanel);
|
|
8379
8490
|
});
|
|
8380
8491
|
|
|
8381
8492
|
if (diffResult.ordered.length > 0) {
|
|
8493
|
+
panels.forEach(function (panel, idx) {
|
|
8494
|
+
var indexDiff = idx - panel.index;
|
|
8495
|
+
|
|
8496
|
+
if (indexDiff > 0) {
|
|
8497
|
+
panel.increaseIndex(indexDiff);
|
|
8498
|
+
} else {
|
|
8499
|
+
panel.decreaseIndex(-indexDiff);
|
|
8500
|
+
}
|
|
8501
|
+
});
|
|
8382
8502
|
panels.sort(function (panel1, panel2) {
|
|
8383
8503
|
return panel1.index - panel2.index;
|
|
8384
8504
|
});
|
|
8505
|
+
panels.forEach(function (panel) {
|
|
8506
|
+
panel.updatePosition();
|
|
8507
|
+
});
|
|
8385
8508
|
}
|
|
8386
8509
|
|
|
8387
8510
|
if (diffResult.added.length > 0) {
|
|
@@ -8394,7 +8517,7 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8394
8517
|
}
|
|
8395
8518
|
|
|
8396
8519
|
if (prevIdx_2 >= 0 && addedIdx !== prevIdx_2 + 1) {
|
|
8397
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1);
|
|
8520
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1, idx + 1)));
|
|
8398
8521
|
startIdx_1 = -1;
|
|
8399
8522
|
prevIdx_2 = -1;
|
|
8400
8523
|
} else {
|
|
@@ -8403,13 +8526,17 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8403
8526
|
});
|
|
8404
8527
|
|
|
8405
8528
|
if (startIdx_1 >= 0) {
|
|
8406
|
-
batchInsert(renderer, diffResult, addedElements_1, startIdx_1);
|
|
8529
|
+
added.push.apply(added, __spread(batchInsert(renderer, diffResult, addedElements_1, startIdx_1)));
|
|
8407
8530
|
}
|
|
8408
8531
|
}
|
|
8532
|
+
|
|
8533
|
+
if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
|
|
8534
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8535
|
+
}
|
|
8409
8536
|
});
|
|
8410
8537
|
|
|
8411
8538
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|
|
8412
|
-
renderer.
|
|
8539
|
+
return renderer.batchInsertDefer.apply(renderer, __spread(diffResult.added.slice(startIdx, endIdx).map(function (index, elIdx) {
|
|
8413
8540
|
return {
|
|
8414
8541
|
index: index,
|
|
8415
8542
|
elements: [addedElements[elIdx]],
|
|
@@ -8420,7 +8547,7 @@ var batchInsert = function (renderer, diffResult, addedElements, startIdx, endId
|
|
|
8420
8547
|
|
|
8421
8548
|
var batchRemove = function (renderer, startIdx, endIdx) {
|
|
8422
8549
|
var removed = renderer.panels.slice(startIdx, endIdx);
|
|
8423
|
-
renderer.
|
|
8550
|
+
return renderer.batchRemoveDefer({
|
|
8424
8551
|
index: startIdx,
|
|
8425
8552
|
deleteCount: removed.length,
|
|
8426
8553
|
hasDOMInElements: false
|