@egjs/flicking 4.6.1 → 4.7.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/declaration/Flicking.d.ts +5 -1
- package/declaration/camera/mode/CameraMode.d.ts +1 -0
- package/declaration/camera/mode/CircularCameraMode.d.ts +1 -0
- package/declaration/control/Control.d.ts +1 -1
- package/dist/flicking.esm.js +247 -204
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +247 -204
- 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 +2573 -5063
- 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 +3 -2
- package/src/Flicking.ts +14 -0
- package/src/camera/Camera.ts +1 -19
- package/src/camera/mode/CameraMode.ts +22 -0
- package/src/camera/mode/CircularCameraMode.ts +27 -0
- package/src/cfc/sync.ts +3 -1
- package/src/control/AxesController.ts +4 -3
- 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 +8 -4
- package/src/control/states/AnimatingState.ts +4 -1
- package/src/control/states/DraggingState.ts +7 -2
- package/src/renderer/Renderer.ts +16 -14
- package/TODO.md +0 -3
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.7.0
|
|
8
8
|
*/
|
|
9
9
|
import Component, { ComponentEvent } from '@egjs/component';
|
|
10
10
|
import Axes, { PanInput } from '@egjs/axes';
|
|
@@ -1868,6 +1868,8 @@ function (_super) {
|
|
|
1868
1868
|
};
|
|
1869
1869
|
|
|
1870
1870
|
__proto.onRelease = function (ctx) {
|
|
1871
|
+
var _a;
|
|
1872
|
+
|
|
1871
1873
|
var flicking = ctx.flicking,
|
|
1872
1874
|
axesEvent = ctx.axesEvent,
|
|
1873
1875
|
transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
|
|
@@ -1887,7 +1889,13 @@ function (_super) {
|
|
|
1887
1889
|
var control = flicking.control;
|
|
1888
1890
|
var position = axesEvent.destPos[POSITION_KEY];
|
|
1889
1891
|
var duration = Math.max(axesEvent.duration, flicking.duration);
|
|
1890
|
-
|
|
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
|
+
}
|
|
1891
1899
|
};
|
|
1892
1900
|
|
|
1893
1901
|
return DraggingState;
|
|
@@ -1963,7 +1971,11 @@ function (_super) {
|
|
|
1963
1971
|
direction: getDirection(animatingContext.start, animatingContext.end),
|
|
1964
1972
|
axesEvent: axesEvent
|
|
1965
1973
|
}));
|
|
1966
|
-
|
|
1974
|
+
var targetPanel = this._targetPanel;
|
|
1975
|
+
|
|
1976
|
+
if (targetPanel) {
|
|
1977
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
1978
|
+
}
|
|
1967
1979
|
};
|
|
1968
1980
|
|
|
1969
1981
|
return AnimatingState;
|
|
@@ -2249,7 +2261,7 @@ function () {
|
|
|
2249
2261
|
get: function () {
|
|
2250
2262
|
var _a, _b;
|
|
2251
2263
|
|
|
2252
|
-
return (_b = (_a = this._panInput) === null || _a === void 0 ? void 0 : _a.
|
|
2264
|
+
return (_b = (_a = this._panInput) === null || _a === void 0 ? void 0 : _a.isEnabled()) !== null && _b !== void 0 ? _b : false;
|
|
2253
2265
|
},
|
|
2254
2266
|
enumerable: false,
|
|
2255
2267
|
configurable: true
|
|
@@ -2320,6 +2332,7 @@ function () {
|
|
|
2320
2332
|
}, _a), {
|
|
2321
2333
|
deceleration: flicking.deceleration,
|
|
2322
2334
|
interruptable: flicking.interruptable,
|
|
2335
|
+
nested: flicking.nested,
|
|
2323
2336
|
easing: flicking.easing
|
|
2324
2337
|
});
|
|
2325
2338
|
this._panInput = new PanInput(flicking.viewport.element, {
|
|
@@ -2416,7 +2429,7 @@ function () {
|
|
|
2416
2429
|
axis.circular = [controlParams.circular, controlParams.circular];
|
|
2417
2430
|
axis.range = [controlParams.range.min, controlParams.range.max];
|
|
2418
2431
|
axis.bounce = parseBounce(flicking.bounce, camera.size);
|
|
2419
|
-
axes.
|
|
2432
|
+
axes.axisManager.set((_a = {}, _a[POSITION_KEY] = controlParams.position, _a));
|
|
2420
2433
|
return this;
|
|
2421
2434
|
};
|
|
2422
2435
|
/**
|
|
@@ -2532,7 +2545,7 @@ function () {
|
|
|
2532
2545
|
var camera = flicking.camera;
|
|
2533
2546
|
animate();
|
|
2534
2547
|
var newPos = flicking.circularEnabled ? circulatePosition(position, camera.range.min, camera.range.max) : position;
|
|
2535
|
-
axes.
|
|
2548
|
+
axes.axisManager.set((_a = {}, _a[POSITION_KEY] = newPos, _a));
|
|
2536
2549
|
return Promise.resolve();
|
|
2537
2550
|
} else {
|
|
2538
2551
|
return new Promise(function (resolve, reject) {
|
|
@@ -2718,7 +2731,7 @@ function () {
|
|
|
2718
2731
|
*/
|
|
2719
2732
|
|
|
2720
2733
|
|
|
2721
|
-
__proto.updatePosition = function (
|
|
2734
|
+
__proto.updatePosition = function (progressInPanel) {
|
|
2722
2735
|
var flicking = getFlickingAttached(this._flicking);
|
|
2723
2736
|
var camera = flicking.camera;
|
|
2724
2737
|
var activePanel = this._activePanel;
|
|
@@ -3094,48 +3107,41 @@ function (_super) {
|
|
|
3094
3107
|
*/
|
|
3095
3108
|
|
|
3096
3109
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
activeAnchor = camera.findActiveAnchor();
|
|
3103
|
-
anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3104
|
-
state = flicking.control.controller.state;
|
|
3110
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3111
|
+
var camera = flicking.camera;
|
|
3112
|
+
var activeAnchor = camera.findActiveAnchor();
|
|
3113
|
+
var anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3114
|
+
var state = flicking.control.controller.state;
|
|
3105
3115
|
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3110
|
-
}
|
|
3116
|
+
if (!activeAnchor || !anchorAtCamera) {
|
|
3117
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3118
|
+
}
|
|
3111
3119
|
|
|
3112
|
-
|
|
3113
|
-
posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3114
|
-
absPosDelta = Math.abs(posDelta);
|
|
3115
|
-
snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3116
|
-
|
|
3117
|
-
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3118
|
-
// Move to anchor at position
|
|
3119
|
-
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3120
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3121
|
-
// Move to the adjacent panel
|
|
3122
|
-
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3123
|
-
} else {
|
|
3124
|
-
// Restore to active panel
|
|
3125
|
-
targetAnchor = anchorAtCamera;
|
|
3126
|
-
}
|
|
3120
|
+
var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
|
|
3127
3121
|
|
|
3128
|
-
|
|
3122
|
+
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3123
|
+
var absPosDelta = Math.abs(posDelta);
|
|
3124
|
+
var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3125
|
+
var targetAnchor;
|
|
3129
3126
|
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3127
|
+
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3128
|
+
// Move to anchor at position
|
|
3129
|
+
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3130
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3131
|
+
// Move to the adjacent panel
|
|
3132
|
+
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3133
|
+
} else {
|
|
3134
|
+
// Restore to active panel
|
|
3135
|
+
targetAnchor = anchorAtCamera;
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
|
|
3139
|
+
|
|
3140
|
+
return this._animateToPosition({
|
|
3141
|
+
position: camera.clampToReachablePosition(targetAnchor.position),
|
|
3142
|
+
duration: duration,
|
|
3143
|
+
newActivePanel: targetAnchor.panel,
|
|
3144
|
+
axesEvent: axesEvent
|
|
3139
3145
|
});
|
|
3140
3146
|
};
|
|
3141
3147
|
|
|
@@ -3324,35 +3330,26 @@ function (_super) {
|
|
|
3324
3330
|
|
|
3325
3331
|
|
|
3326
3332
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
camera = flicking.camera;
|
|
3332
|
-
targetPos = camera.clampToReachablePosition(position);
|
|
3333
|
-
anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3333
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3334
|
+
var camera = flicking.camera;
|
|
3335
|
+
var targetPos = camera.clampToReachablePosition(position);
|
|
3336
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3334
3337
|
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3339
|
-
}
|
|
3338
|
+
if (!anchorAtPosition) {
|
|
3339
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3340
|
+
}
|
|
3340
3341
|
|
|
3341
|
-
|
|
3342
|
+
var targetPanel = anchorAtPosition.panel; // Trigger only change event
|
|
3342
3343
|
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3344
|
+
if (targetPanel !== this._activePanel) {
|
|
3345
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3346
|
+
}
|
|
3346
3347
|
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
newActivePanel: targetPanel,
|
|
3353
|
-
axesEvent: axesEvent
|
|
3354
|
-
})];
|
|
3355
|
-
});
|
|
3348
|
+
return this._animateToPosition({
|
|
3349
|
+
position: this._stopAtEdge ? targetPos : position,
|
|
3350
|
+
duration: duration,
|
|
3351
|
+
newActivePanel: targetPanel,
|
|
3352
|
+
axesEvent: axesEvent
|
|
3356
3353
|
});
|
|
3357
3354
|
};
|
|
3358
3355
|
|
|
@@ -3550,62 +3547,57 @@ function (_super) {
|
|
|
3550
3547
|
|
|
3551
3548
|
|
|
3552
3549
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
cameraRange = camera.range;
|
|
3562
|
-
clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3563
|
-
anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3564
|
-
|
|
3565
|
-
if (!anchorAtPosition || !activePanel) {
|
|
3566
|
-
return [2
|
|
3567
|
-
/*return*/
|
|
3568
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3569
|
-
}
|
|
3550
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3551
|
+
var camera = flicking.camera;
|
|
3552
|
+
var activePanel = this._activePanel;
|
|
3553
|
+
var axesRange = this._controller.range;
|
|
3554
|
+
var indexRange = this._indexRange;
|
|
3555
|
+
var cameraRange = camera.range;
|
|
3556
|
+
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3557
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3570
3558
|
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
anchors = camera.anchorPoints;
|
|
3575
|
-
firstAnchor = anchors[0];
|
|
3576
|
-
lastAnchor = anchors[anchors.length - 1];
|
|
3577
|
-
shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3578
|
-
shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3579
|
-
|
|
3580
|
-
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3581
|
-
targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3582
|
-
targetPanel = targetAnchor.panel;
|
|
3583
|
-
targetPos = targetAnchor.position;
|
|
3584
|
-
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
3585
|
-
// Move to anchor at position
|
|
3586
|
-
targetPanel = anchorAtPosition.panel;
|
|
3587
|
-
targetPos = anchorAtPosition.position;
|
|
3588
|
-
} else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
|
|
3589
|
-
// Move to adjacent anchor
|
|
3590
|
-
targetPanel = adjacentAnchor.panel;
|
|
3591
|
-
targetPos = adjacentAnchor.position;
|
|
3592
|
-
} else {
|
|
3593
|
-
// Restore to active panel
|
|
3594
|
-
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
3595
|
-
targetPanel = activePanel;
|
|
3596
|
-
}
|
|
3559
|
+
if (!anchorAtPosition || !activePanel) {
|
|
3560
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3561
|
+
}
|
|
3597
3562
|
|
|
3598
|
-
|
|
3563
|
+
var prevPos = activePanel.position;
|
|
3564
|
+
var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
|
|
3565
|
+
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
3566
|
+
var targetPos;
|
|
3567
|
+
var targetPanel;
|
|
3568
|
+
var anchors = camera.anchorPoints;
|
|
3569
|
+
var firstAnchor = anchors[0];
|
|
3570
|
+
var lastAnchor = anchors[anchors.length - 1];
|
|
3571
|
+
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3572
|
+
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3573
|
+
var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
|
|
3574
|
+
|
|
3575
|
+
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3576
|
+
// In bounce area
|
|
3577
|
+
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3578
|
+
targetPanel = targetAnchor.panel;
|
|
3579
|
+
targetPos = targetAnchor.position;
|
|
3580
|
+
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
3581
|
+
// Move to anchor at position
|
|
3582
|
+
targetPanel = anchorAtPosition.panel;
|
|
3583
|
+
targetPos = anchorAtPosition.position;
|
|
3584
|
+
} else if (isOverThreshold && isAdjacent) {
|
|
3585
|
+
// Move to adjacent anchor
|
|
3586
|
+
targetPanel = adjacentAnchor.panel;
|
|
3587
|
+
targetPos = adjacentAnchor.position;
|
|
3588
|
+
} else {
|
|
3589
|
+
// Restore to active panel
|
|
3590
|
+
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
3591
|
+
targetPanel = activePanel;
|
|
3592
|
+
}
|
|
3599
3593
|
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
})];
|
|
3608
|
-
});
|
|
3594
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3595
|
+
|
|
3596
|
+
return this._animateToPosition({
|
|
3597
|
+
position: targetPos,
|
|
3598
|
+
duration: duration,
|
|
3599
|
+
newActivePanel: targetPanel,
|
|
3600
|
+
axesEvent: axesEvent
|
|
3609
3601
|
});
|
|
3610
3602
|
};
|
|
3611
3603
|
|
|
@@ -3655,6 +3647,27 @@ function () {
|
|
|
3655
3647
|
}, null);
|
|
3656
3648
|
};
|
|
3657
3649
|
|
|
3650
|
+
__proto.findNearestAnchor = function (position) {
|
|
3651
|
+
var anchors = this._flicking.camera.anchorPoints;
|
|
3652
|
+
if (anchors.length <= 0) return null;
|
|
3653
|
+
var prevDist = Infinity;
|
|
3654
|
+
|
|
3655
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3656
|
+
var anchor = anchors[anchorIdx];
|
|
3657
|
+
var dist = Math.abs(anchor.position - position);
|
|
3658
|
+
|
|
3659
|
+
if (dist > prevDist) {
|
|
3660
|
+
// Return previous anchor
|
|
3661
|
+
return anchors[anchorIdx - 1];
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
prevDist = dist;
|
|
3665
|
+
} // Return last anchor
|
|
3666
|
+
|
|
3667
|
+
|
|
3668
|
+
return anchors[anchors.length - 1];
|
|
3669
|
+
};
|
|
3670
|
+
|
|
3658
3671
|
__proto.clampToReachablePosition = function (position) {
|
|
3659
3672
|
var camera = this._flicking.camera;
|
|
3660
3673
|
var range = camera.range;
|
|
@@ -3784,6 +3797,28 @@ function (_super) {
|
|
|
3784
3797
|
});
|
|
3785
3798
|
};
|
|
3786
3799
|
|
|
3800
|
+
__proto.findNearestAnchor = function (position) {
|
|
3801
|
+
var camera = this._flicking.camera;
|
|
3802
|
+
var anchors = camera.anchorPoints;
|
|
3803
|
+
if (anchors.length <= 0) return null;
|
|
3804
|
+
var camRange = camera.range;
|
|
3805
|
+
var minDist = Infinity;
|
|
3806
|
+
var minDistIndex = -1;
|
|
3807
|
+
|
|
3808
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3809
|
+
var anchor = anchors[anchorIdx];
|
|
3810
|
+
var dist = Math.min(Math.abs(anchor.position - position), Math.abs(anchor.position - camRange.min + camRange.max - position), Math.abs(position - camRange.min + camRange.max - anchor.position));
|
|
3811
|
+
|
|
3812
|
+
if (dist < minDist) {
|
|
3813
|
+
minDist = dist;
|
|
3814
|
+
minDistIndex = anchorIdx;
|
|
3815
|
+
}
|
|
3816
|
+
} // Return last anchor
|
|
3817
|
+
|
|
3818
|
+
|
|
3819
|
+
return anchors[minDistIndex];
|
|
3820
|
+
};
|
|
3821
|
+
|
|
3787
3822
|
__proto.findAnchorIncludePosition = function (position) {
|
|
3788
3823
|
var camera = this._flicking.camera;
|
|
3789
3824
|
var range = camera.range;
|
|
@@ -4552,24 +4587,7 @@ function () {
|
|
|
4552
4587
|
|
|
4553
4588
|
|
|
4554
4589
|
__proto.findNearestAnchor = function (position) {
|
|
4555
|
-
|
|
4556
|
-
if (anchors.length <= 0) return null;
|
|
4557
|
-
var prevDist = Infinity;
|
|
4558
|
-
|
|
4559
|
-
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
4560
|
-
var anchor = anchors[anchorIdx];
|
|
4561
|
-
var dist = Math.abs(anchor.position - position);
|
|
4562
|
-
|
|
4563
|
-
if (dist > prevDist) {
|
|
4564
|
-
// Return previous anchor
|
|
4565
|
-
return anchors[anchorIdx - 1];
|
|
4566
|
-
}
|
|
4567
|
-
|
|
4568
|
-
prevDist = dist;
|
|
4569
|
-
} // Return last anchor
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
return anchors[anchors.length - 1];
|
|
4590
|
+
return this._mode.findNearestAnchor(position);
|
|
4573
4591
|
};
|
|
4574
4592
|
/**
|
|
4575
4593
|
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
@@ -5253,29 +5271,31 @@ function () {
|
|
|
5253
5271
|
|
|
5254
5272
|
void this.render();
|
|
5255
5273
|
|
|
5256
|
-
if (!
|
|
5257
|
-
if (
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5274
|
+
if (!flicking.animating) {
|
|
5275
|
+
if (!activePanel || activePanel.removed) {
|
|
5276
|
+
if (panels.length <= 0) {
|
|
5277
|
+
// All panels removed
|
|
5278
|
+
camera.lookAt(0);
|
|
5279
|
+
} else {
|
|
5280
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
5262
5281
|
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5282
|
+
if (targetIndex > panels.length - 1) {
|
|
5283
|
+
targetIndex = panels.length - 1;
|
|
5284
|
+
}
|
|
5266
5285
|
|
|
5267
|
-
|
|
5286
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5287
|
+
duration: 0
|
|
5288
|
+
}).catch(function () {
|
|
5289
|
+
return void 0;
|
|
5290
|
+
});
|
|
5291
|
+
}
|
|
5292
|
+
} else {
|
|
5293
|
+
void control.moveToPanel(activePanel, {
|
|
5268
5294
|
duration: 0
|
|
5269
5295
|
}).catch(function () {
|
|
5270
5296
|
return void 0;
|
|
5271
5297
|
});
|
|
5272
5298
|
}
|
|
5273
|
-
} else {
|
|
5274
|
-
void control.moveToPanel(control.activePanel, {
|
|
5275
|
-
duration: 0
|
|
5276
|
-
}).catch(function () {
|
|
5277
|
-
return void 0;
|
|
5278
|
-
});
|
|
5279
5299
|
}
|
|
5280
5300
|
|
|
5281
5301
|
flicking.camera.updateOffset();
|
|
@@ -6612,52 +6632,54 @@ function (_super) {
|
|
|
6612
6632
|
noPanelStyleOverride = _l === void 0 ? false : _l,
|
|
6613
6633
|
_m = _b.resizeOnContentsReady,
|
|
6614
6634
|
resizeOnContentsReady = _m === void 0 ? false : _m,
|
|
6615
|
-
_o = _b.
|
|
6616
|
-
|
|
6617
|
-
_p = _b.
|
|
6618
|
-
|
|
6619
|
-
_q = _b.
|
|
6620
|
-
|
|
6621
|
-
_r = _b.
|
|
6622
|
-
|
|
6623
|
-
_s = _b.
|
|
6624
|
-
|
|
6635
|
+
_o = _b.nested,
|
|
6636
|
+
nested = _o === void 0 ? false : _o,
|
|
6637
|
+
_p = _b.needPanelThreshold,
|
|
6638
|
+
needPanelThreshold = _p === void 0 ? 0 : _p,
|
|
6639
|
+
_q = _b.preventEventsBeforeInit,
|
|
6640
|
+
preventEventsBeforeInit = _q === void 0 ? true : _q,
|
|
6641
|
+
_r = _b.deceleration,
|
|
6642
|
+
deceleration = _r === void 0 ? 0.0075 : _r,
|
|
6643
|
+
_s = _b.duration,
|
|
6644
|
+
duration = _s === void 0 ? 500 : _s,
|
|
6645
|
+
_t = _b.easing,
|
|
6646
|
+
easing = _t === void 0 ? function (x) {
|
|
6625
6647
|
return 1 - Math.pow(1 - x, 3);
|
|
6626
|
-
} :
|
|
6627
|
-
|
|
6628
|
-
inputType =
|
|
6629
|
-
|
|
6630
|
-
moveType =
|
|
6631
|
-
|
|
6632
|
-
threshold =
|
|
6633
|
-
|
|
6634
|
-
interruptable =
|
|
6635
|
-
|
|
6636
|
-
bounce =
|
|
6637
|
-
|
|
6638
|
-
iOSEdgeSwipeThreshold =
|
|
6639
|
-
|
|
6640
|
-
preventClickOnDrag =
|
|
6641
|
-
|
|
6642
|
-
disableOnInit =
|
|
6643
|
-
|
|
6644
|
-
renderOnlyVisible =
|
|
6645
|
-
|
|
6646
|
-
virtual =
|
|
6647
|
-
|
|
6648
|
-
autoInit =
|
|
6649
|
-
|
|
6650
|
-
autoResize =
|
|
6651
|
-
|
|
6652
|
-
useResizeObserver =
|
|
6653
|
-
|
|
6654
|
-
resizeDebounce =
|
|
6655
|
-
|
|
6656
|
-
maxResizeDebounce =
|
|
6657
|
-
|
|
6658
|
-
externalRenderer =
|
|
6659
|
-
|
|
6660
|
-
renderExternal =
|
|
6648
|
+
} : _t,
|
|
6649
|
+
_u = _b.inputType,
|
|
6650
|
+
inputType = _u === void 0 ? ["mouse", "touch"] : _u,
|
|
6651
|
+
_v = _b.moveType,
|
|
6652
|
+
moveType = _v === void 0 ? "snap" : _v,
|
|
6653
|
+
_w = _b.threshold,
|
|
6654
|
+
threshold = _w === void 0 ? 40 : _w,
|
|
6655
|
+
_x = _b.interruptable,
|
|
6656
|
+
interruptable = _x === void 0 ? true : _x,
|
|
6657
|
+
_y = _b.bounce,
|
|
6658
|
+
bounce = _y === void 0 ? "20%" : _y,
|
|
6659
|
+
_z = _b.iOSEdgeSwipeThreshold,
|
|
6660
|
+
iOSEdgeSwipeThreshold = _z === void 0 ? 30 : _z,
|
|
6661
|
+
_0 = _b.preventClickOnDrag,
|
|
6662
|
+
preventClickOnDrag = _0 === void 0 ? true : _0,
|
|
6663
|
+
_1 = _b.disableOnInit,
|
|
6664
|
+
disableOnInit = _1 === void 0 ? false : _1,
|
|
6665
|
+
_2 = _b.renderOnlyVisible,
|
|
6666
|
+
renderOnlyVisible = _2 === void 0 ? false : _2,
|
|
6667
|
+
_3 = _b.virtual,
|
|
6668
|
+
virtual = _3 === void 0 ? null : _3,
|
|
6669
|
+
_4 = _b.autoInit,
|
|
6670
|
+
autoInit = _4 === void 0 ? true : _4,
|
|
6671
|
+
_5 = _b.autoResize,
|
|
6672
|
+
autoResize = _5 === void 0 ? true : _5,
|
|
6673
|
+
_6 = _b.useResizeObserver,
|
|
6674
|
+
useResizeObserver = _6 === void 0 ? true : _6,
|
|
6675
|
+
_7 = _b.resizeDebounce,
|
|
6676
|
+
resizeDebounce = _7 === void 0 ? 0 : _7,
|
|
6677
|
+
_8 = _b.maxResizeDebounce,
|
|
6678
|
+
maxResizeDebounce = _8 === void 0 ? 100 : _8,
|
|
6679
|
+
_9 = _b.externalRenderer,
|
|
6680
|
+
externalRenderer = _9 === void 0 ? null : _9,
|
|
6681
|
+
_10 = _b.renderExternal,
|
|
6682
|
+
renderExternal = _10 === void 0 ? null : _10;
|
|
6661
6683
|
|
|
6662
6684
|
var _this = _super.call(this) || this; // Internal states
|
|
6663
6685
|
|
|
@@ -6675,6 +6697,7 @@ function (_super) {
|
|
|
6675
6697
|
_this._panelsPerView = panelsPerView;
|
|
6676
6698
|
_this._noPanelStyleOverride = noPanelStyleOverride;
|
|
6677
6699
|
_this._resizeOnContentsReady = resizeOnContentsReady;
|
|
6700
|
+
_this._nested = nested;
|
|
6678
6701
|
_this._virtual = virtual;
|
|
6679
6702
|
_this._needPanelThreshold = needPanelThreshold;
|
|
6680
6703
|
_this._preventEventsBeforeInit = preventEventsBeforeInit;
|
|
@@ -7148,6 +7171,24 @@ function (_super) {
|
|
|
7148
7171
|
enumerable: false,
|
|
7149
7172
|
configurable: true
|
|
7150
7173
|
});
|
|
7174
|
+
Object.defineProperty(__proto, "nested", {
|
|
7175
|
+
/**
|
|
7176
|
+
* If you enable this option on child Flicking when the Flicking is placed inside the Flicking, the parent Flicking will move in the same direction after the child Flicking reaches the first/last panel.
|
|
7177
|
+
* If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
|
|
7178
|
+
* @ko Flicking 내부에 Flicking이 배치될 때 하위 Flicking에서 이 옵션을 활성화하면 하위 Flicking이 첫/마지막 패널에 도달한 뒤부터 같은 방향으로 상위 Flicking이 움직입니다.
|
|
7179
|
+
* 만약 상위 Flicking과 하위 Flicking이 서로 다른 horizontal 옵션을 가지고 있다면 이 옵션을 설정할 필요가 없습니다.
|
|
7180
|
+
* @type {boolean}
|
|
7181
|
+
* @default false
|
|
7182
|
+
*/
|
|
7183
|
+
get: function () {
|
|
7184
|
+
return this._nested;
|
|
7185
|
+
},
|
|
7186
|
+
set: function (val) {
|
|
7187
|
+
this._nested = val;
|
|
7188
|
+
},
|
|
7189
|
+
enumerable: false,
|
|
7190
|
+
configurable: true
|
|
7191
|
+
});
|
|
7151
7192
|
Object.defineProperty(__proto, "needPanelThreshold", {
|
|
7152
7193
|
// EVENTS
|
|
7153
7194
|
|
|
@@ -8384,7 +8425,7 @@ function (_super) {
|
|
|
8384
8425
|
*/
|
|
8385
8426
|
|
|
8386
8427
|
|
|
8387
|
-
Flicking.VERSION = "4.
|
|
8428
|
+
Flicking.VERSION = "4.7.0";
|
|
8388
8429
|
return Flicking;
|
|
8389
8430
|
}(Component);
|
|
8390
8431
|
|
|
@@ -8538,7 +8579,9 @@ var sync = (function (flicking, diffResult, rendered) {
|
|
|
8538
8579
|
}
|
|
8539
8580
|
}
|
|
8540
8581
|
|
|
8541
|
-
|
|
8582
|
+
if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
|
|
8583
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8584
|
+
}
|
|
8542
8585
|
});
|
|
8543
8586
|
|
|
8544
8587
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|