@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.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
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/component'), require('@egjs/axes'), require('@egjs/imready')) :
|
|
@@ -1913,6 +1913,8 @@ version: 4.6.1
|
|
|
1913
1913
|
};
|
|
1914
1914
|
|
|
1915
1915
|
__proto.onRelease = function (ctx) {
|
|
1916
|
+
var _a;
|
|
1917
|
+
|
|
1916
1918
|
var flicking = ctx.flicking,
|
|
1917
1919
|
axesEvent = ctx.axesEvent,
|
|
1918
1920
|
transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
|
|
@@ -1932,7 +1934,13 @@ version: 4.6.1
|
|
|
1932
1934
|
var control = flicking.control;
|
|
1933
1935
|
var position = axesEvent.destPos[POSITION_KEY];
|
|
1934
1936
|
var duration = Math.max(axesEvent.duration, flicking.duration);
|
|
1935
|
-
|
|
1937
|
+
|
|
1938
|
+
try {
|
|
1939
|
+
void control.moveToPosition(position, duration, axesEvent);
|
|
1940
|
+
} catch (err) {
|
|
1941
|
+
transitTo(STATE_TYPE.IDLE);
|
|
1942
|
+
axesEvent.setTo((_a = {}, _a[POSITION_KEY] = flicking.camera.position, _a), 0);
|
|
1943
|
+
}
|
|
1936
1944
|
};
|
|
1937
1945
|
|
|
1938
1946
|
return DraggingState;
|
|
@@ -2008,7 +2016,11 @@ version: 4.6.1
|
|
|
2008
2016
|
direction: getDirection(animatingContext.start, animatingContext.end),
|
|
2009
2017
|
axesEvent: axesEvent
|
|
2010
2018
|
}));
|
|
2011
|
-
|
|
2019
|
+
var targetPanel = this._targetPanel;
|
|
2020
|
+
|
|
2021
|
+
if (targetPanel) {
|
|
2022
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
2023
|
+
}
|
|
2012
2024
|
};
|
|
2013
2025
|
|
|
2014
2026
|
return AnimatingState;
|
|
@@ -2294,7 +2306,7 @@ version: 4.6.1
|
|
|
2294
2306
|
get: function () {
|
|
2295
2307
|
var _a, _b;
|
|
2296
2308
|
|
|
2297
|
-
return (_b = (_a = this._panInput) === null || _a === void 0 ? void 0 : _a.
|
|
2309
|
+
return (_b = (_a = this._panInput) === null || _a === void 0 ? void 0 : _a.isEnabled()) !== null && _b !== void 0 ? _b : false;
|
|
2298
2310
|
},
|
|
2299
2311
|
enumerable: false,
|
|
2300
2312
|
configurable: true
|
|
@@ -2365,6 +2377,7 @@ version: 4.6.1
|
|
|
2365
2377
|
}, _a), {
|
|
2366
2378
|
deceleration: flicking.deceleration,
|
|
2367
2379
|
interruptable: flicking.interruptable,
|
|
2380
|
+
nested: flicking.nested,
|
|
2368
2381
|
easing: flicking.easing
|
|
2369
2382
|
});
|
|
2370
2383
|
this._panInput = new Axes.PanInput(flicking.viewport.element, {
|
|
@@ -2461,7 +2474,7 @@ version: 4.6.1
|
|
|
2461
2474
|
axis.circular = [controlParams.circular, controlParams.circular];
|
|
2462
2475
|
axis.range = [controlParams.range.min, controlParams.range.max];
|
|
2463
2476
|
axis.bounce = parseBounce(flicking.bounce, camera.size);
|
|
2464
|
-
axes.
|
|
2477
|
+
axes.axisManager.set((_a = {}, _a[POSITION_KEY] = controlParams.position, _a));
|
|
2465
2478
|
return this;
|
|
2466
2479
|
};
|
|
2467
2480
|
/**
|
|
@@ -2577,7 +2590,7 @@ version: 4.6.1
|
|
|
2577
2590
|
var camera = flicking.camera;
|
|
2578
2591
|
animate();
|
|
2579
2592
|
var newPos = flicking.circularEnabled ? circulatePosition(position, camera.range.min, camera.range.max) : position;
|
|
2580
|
-
axes.
|
|
2593
|
+
axes.axisManager.set((_a = {}, _a[POSITION_KEY] = newPos, _a));
|
|
2581
2594
|
return Promise.resolve();
|
|
2582
2595
|
} else {
|
|
2583
2596
|
return new Promise(function (resolve, reject) {
|
|
@@ -2763,7 +2776,7 @@ version: 4.6.1
|
|
|
2763
2776
|
*/
|
|
2764
2777
|
|
|
2765
2778
|
|
|
2766
|
-
__proto.updatePosition = function (
|
|
2779
|
+
__proto.updatePosition = function (progressInPanel) {
|
|
2767
2780
|
var flicking = getFlickingAttached(this._flicking);
|
|
2768
2781
|
var camera = flicking.camera;
|
|
2769
2782
|
var activePanel = this._activePanel;
|
|
@@ -3139,48 +3152,41 @@ version: 4.6.1
|
|
|
3139
3152
|
*/
|
|
3140
3153
|
|
|
3141
3154
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
activeAnchor = camera.findActiveAnchor();
|
|
3148
|
-
anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3149
|
-
state = flicking.control.controller.state;
|
|
3155
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3156
|
+
var camera = flicking.camera;
|
|
3157
|
+
var activeAnchor = camera.findActiveAnchor();
|
|
3158
|
+
var anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
3159
|
+
var state = flicking.control.controller.state;
|
|
3150
3160
|
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3155
|
-
}
|
|
3161
|
+
if (!activeAnchor || !anchorAtCamera) {
|
|
3162
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3163
|
+
}
|
|
3156
3164
|
|
|
3157
|
-
|
|
3158
|
-
posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3159
|
-
absPosDelta = Math.abs(posDelta);
|
|
3160
|
-
snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3161
|
-
|
|
3162
|
-
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3163
|
-
// Move to anchor at position
|
|
3164
|
-
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3165
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3166
|
-
// Move to the adjacent panel
|
|
3167
|
-
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3168
|
-
} else {
|
|
3169
|
-
// Restore to active panel
|
|
3170
|
-
targetAnchor = anchorAtCamera;
|
|
3171
|
-
}
|
|
3165
|
+
var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
|
|
3172
3166
|
|
|
3173
|
-
|
|
3167
|
+
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
3168
|
+
var absPosDelta = Math.abs(posDelta);
|
|
3169
|
+
var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
3170
|
+
var targetAnchor;
|
|
3174
3171
|
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3172
|
+
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
3173
|
+
// Move to anchor at position
|
|
3174
|
+
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
3175
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
3176
|
+
// Move to the adjacent panel
|
|
3177
|
+
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
3178
|
+
} else {
|
|
3179
|
+
// Restore to active panel
|
|
3180
|
+
targetAnchor = anchorAtCamera;
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
|
|
3184
|
+
|
|
3185
|
+
return this._animateToPosition({
|
|
3186
|
+
position: camera.clampToReachablePosition(targetAnchor.position),
|
|
3187
|
+
duration: duration,
|
|
3188
|
+
newActivePanel: targetAnchor.panel,
|
|
3189
|
+
axesEvent: axesEvent
|
|
3184
3190
|
});
|
|
3185
3191
|
};
|
|
3186
3192
|
|
|
@@ -3369,35 +3375,26 @@ version: 4.6.1
|
|
|
3369
3375
|
|
|
3370
3376
|
|
|
3371
3377
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
camera = flicking.camera;
|
|
3377
|
-
targetPos = camera.clampToReachablePosition(position);
|
|
3378
|
-
anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3378
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3379
|
+
var camera = flicking.camera;
|
|
3380
|
+
var targetPos = camera.clampToReachablePosition(position);
|
|
3381
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
3379
3382
|
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3384
|
-
}
|
|
3383
|
+
if (!anchorAtPosition) {
|
|
3384
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3385
|
+
}
|
|
3385
3386
|
|
|
3386
|
-
|
|
3387
|
+
var targetPanel = anchorAtPosition.panel; // Trigger only change event
|
|
3387
3388
|
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3389
|
+
if (targetPanel !== this._activePanel) {
|
|
3390
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3391
|
+
}
|
|
3391
3392
|
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
newActivePanel: targetPanel,
|
|
3398
|
-
axesEvent: axesEvent
|
|
3399
|
-
})];
|
|
3400
|
-
});
|
|
3393
|
+
return this._animateToPosition({
|
|
3394
|
+
position: this._stopAtEdge ? targetPos : position,
|
|
3395
|
+
duration: duration,
|
|
3396
|
+
newActivePanel: targetPanel,
|
|
3397
|
+
axesEvent: axesEvent
|
|
3401
3398
|
});
|
|
3402
3399
|
};
|
|
3403
3400
|
|
|
@@ -3595,62 +3592,57 @@ version: 4.6.1
|
|
|
3595
3592
|
|
|
3596
3593
|
|
|
3597
3594
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
cameraRange = camera.range;
|
|
3607
|
-
clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3608
|
-
anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3609
|
-
|
|
3610
|
-
if (!anchorAtPosition || !activePanel) {
|
|
3611
|
-
return [2
|
|
3612
|
-
/*return*/
|
|
3613
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
3614
|
-
}
|
|
3595
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
3596
|
+
var camera = flicking.camera;
|
|
3597
|
+
var activePanel = this._activePanel;
|
|
3598
|
+
var axesRange = this._controller.range;
|
|
3599
|
+
var indexRange = this._indexRange;
|
|
3600
|
+
var cameraRange = camera.range;
|
|
3601
|
+
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
3602
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
3615
3603
|
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
anchors = camera.anchorPoints;
|
|
3620
|
-
firstAnchor = anchors[0];
|
|
3621
|
-
lastAnchor = anchors[anchors.length - 1];
|
|
3622
|
-
shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3623
|
-
shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3624
|
-
|
|
3625
|
-
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3626
|
-
targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3627
|
-
targetPanel = targetAnchor.panel;
|
|
3628
|
-
targetPos = targetAnchor.position;
|
|
3629
|
-
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
3630
|
-
// Move to anchor at position
|
|
3631
|
-
targetPanel = anchorAtPosition.panel;
|
|
3632
|
-
targetPos = anchorAtPosition.position;
|
|
3633
|
-
} else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
|
|
3634
|
-
// Move to adjacent anchor
|
|
3635
|
-
targetPanel = adjacentAnchor.panel;
|
|
3636
|
-
targetPos = adjacentAnchor.position;
|
|
3637
|
-
} else {
|
|
3638
|
-
// Restore to active panel
|
|
3639
|
-
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
3640
|
-
targetPanel = activePanel;
|
|
3641
|
-
}
|
|
3604
|
+
if (!anchorAtPosition || !activePanel) {
|
|
3605
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
3606
|
+
}
|
|
3642
3607
|
|
|
3643
|
-
|
|
3608
|
+
var prevPos = activePanel.position;
|
|
3609
|
+
var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
|
|
3610
|
+
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
3611
|
+
var targetPos;
|
|
3612
|
+
var targetPanel;
|
|
3613
|
+
var anchors = camera.anchorPoints;
|
|
3614
|
+
var firstAnchor = anchors[0];
|
|
3615
|
+
var lastAnchor = anchors[anchors.length - 1];
|
|
3616
|
+
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3617
|
+
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3618
|
+
var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
|
|
3619
|
+
|
|
3620
|
+
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3621
|
+
// In bounce area
|
|
3622
|
+
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
3623
|
+
targetPanel = targetAnchor.panel;
|
|
3624
|
+
targetPos = targetAnchor.position;
|
|
3625
|
+
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
3626
|
+
// Move to anchor at position
|
|
3627
|
+
targetPanel = anchorAtPosition.panel;
|
|
3628
|
+
targetPos = anchorAtPosition.position;
|
|
3629
|
+
} else if (isOverThreshold && isAdjacent) {
|
|
3630
|
+
// Move to adjacent anchor
|
|
3631
|
+
targetPanel = adjacentAnchor.panel;
|
|
3632
|
+
targetPos = adjacentAnchor.position;
|
|
3633
|
+
} else {
|
|
3634
|
+
// Restore to active panel
|
|
3635
|
+
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
3636
|
+
targetPanel = activePanel;
|
|
3637
|
+
}
|
|
3644
3638
|
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
})];
|
|
3653
|
-
});
|
|
3639
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
3640
|
+
|
|
3641
|
+
return this._animateToPosition({
|
|
3642
|
+
position: targetPos,
|
|
3643
|
+
duration: duration,
|
|
3644
|
+
newActivePanel: targetPanel,
|
|
3645
|
+
axesEvent: axesEvent
|
|
3654
3646
|
});
|
|
3655
3647
|
};
|
|
3656
3648
|
|
|
@@ -3721,6 +3713,27 @@ version: 4.6.1
|
|
|
3721
3713
|
}, null);
|
|
3722
3714
|
};
|
|
3723
3715
|
|
|
3716
|
+
__proto.findNearestAnchor = function (position) {
|
|
3717
|
+
var anchors = this._flicking.camera.anchorPoints;
|
|
3718
|
+
if (anchors.length <= 0) return null;
|
|
3719
|
+
var prevDist = Infinity;
|
|
3720
|
+
|
|
3721
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3722
|
+
var anchor = anchors[anchorIdx];
|
|
3723
|
+
var dist = Math.abs(anchor.position - position);
|
|
3724
|
+
|
|
3725
|
+
if (dist > prevDist) {
|
|
3726
|
+
// Return previous anchor
|
|
3727
|
+
return anchors[anchorIdx - 1];
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
prevDist = dist;
|
|
3731
|
+
} // Return last anchor
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
return anchors[anchors.length - 1];
|
|
3735
|
+
};
|
|
3736
|
+
|
|
3724
3737
|
__proto.clampToReachablePosition = function (position) {
|
|
3725
3738
|
var camera = this._flicking.camera;
|
|
3726
3739
|
var range = camera.range;
|
|
@@ -3850,6 +3863,28 @@ version: 4.6.1
|
|
|
3850
3863
|
});
|
|
3851
3864
|
};
|
|
3852
3865
|
|
|
3866
|
+
__proto.findNearestAnchor = function (position) {
|
|
3867
|
+
var camera = this._flicking.camera;
|
|
3868
|
+
var anchors = camera.anchorPoints;
|
|
3869
|
+
if (anchors.length <= 0) return null;
|
|
3870
|
+
var camRange = camera.range;
|
|
3871
|
+
var minDist = Infinity;
|
|
3872
|
+
var minDistIndex = -1;
|
|
3873
|
+
|
|
3874
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3875
|
+
var anchor = anchors[anchorIdx];
|
|
3876
|
+
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));
|
|
3877
|
+
|
|
3878
|
+
if (dist < minDist) {
|
|
3879
|
+
minDist = dist;
|
|
3880
|
+
minDistIndex = anchorIdx;
|
|
3881
|
+
}
|
|
3882
|
+
} // Return last anchor
|
|
3883
|
+
|
|
3884
|
+
|
|
3885
|
+
return anchors[minDistIndex];
|
|
3886
|
+
};
|
|
3887
|
+
|
|
3853
3888
|
__proto.findAnchorIncludePosition = function (position) {
|
|
3854
3889
|
var camera = this._flicking.camera;
|
|
3855
3890
|
var range = camera.range;
|
|
@@ -4618,24 +4653,7 @@ version: 4.6.1
|
|
|
4618
4653
|
|
|
4619
4654
|
|
|
4620
4655
|
__proto.findNearestAnchor = function (position) {
|
|
4621
|
-
|
|
4622
|
-
if (anchors.length <= 0) return null;
|
|
4623
|
-
var prevDist = Infinity;
|
|
4624
|
-
|
|
4625
|
-
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
4626
|
-
var anchor = anchors[anchorIdx];
|
|
4627
|
-
var dist = Math.abs(anchor.position - position);
|
|
4628
|
-
|
|
4629
|
-
if (dist > prevDist) {
|
|
4630
|
-
// Return previous anchor
|
|
4631
|
-
return anchors[anchorIdx - 1];
|
|
4632
|
-
}
|
|
4633
|
-
|
|
4634
|
-
prevDist = dist;
|
|
4635
|
-
} // Return last anchor
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
return anchors[anchors.length - 1];
|
|
4656
|
+
return this._mode.findNearestAnchor(position);
|
|
4639
4657
|
};
|
|
4640
4658
|
/**
|
|
4641
4659
|
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
@@ -5332,29 +5350,31 @@ version: 4.6.1
|
|
|
5332
5350
|
|
|
5333
5351
|
void this.render();
|
|
5334
5352
|
|
|
5335
|
-
if (!
|
|
5336
|
-
if (
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5353
|
+
if (!flicking.animating) {
|
|
5354
|
+
if (!activePanel || activePanel.removed) {
|
|
5355
|
+
if (panels.length <= 0) {
|
|
5356
|
+
// All panels removed
|
|
5357
|
+
camera.lookAt(0);
|
|
5358
|
+
} else {
|
|
5359
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
5341
5360
|
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5361
|
+
if (targetIndex > panels.length - 1) {
|
|
5362
|
+
targetIndex = panels.length - 1;
|
|
5363
|
+
}
|
|
5345
5364
|
|
|
5346
|
-
|
|
5365
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
5366
|
+
duration: 0
|
|
5367
|
+
}).catch(function () {
|
|
5368
|
+
return void 0;
|
|
5369
|
+
});
|
|
5370
|
+
}
|
|
5371
|
+
} else {
|
|
5372
|
+
void control.moveToPanel(activePanel, {
|
|
5347
5373
|
duration: 0
|
|
5348
5374
|
}).catch(function () {
|
|
5349
5375
|
return void 0;
|
|
5350
5376
|
});
|
|
5351
5377
|
}
|
|
5352
|
-
} else {
|
|
5353
|
-
void control.moveToPanel(control.activePanel, {
|
|
5354
|
-
duration: 0
|
|
5355
|
-
}).catch(function () {
|
|
5356
|
-
return void 0;
|
|
5357
|
-
});
|
|
5358
5378
|
}
|
|
5359
5379
|
|
|
5360
5380
|
flicking.camera.updateOffset();
|
|
@@ -6705,52 +6725,54 @@ version: 4.6.1
|
|
|
6705
6725
|
noPanelStyleOverride = _l === void 0 ? false : _l,
|
|
6706
6726
|
_m = _b.resizeOnContentsReady,
|
|
6707
6727
|
resizeOnContentsReady = _m === void 0 ? false : _m,
|
|
6708
|
-
_o = _b.
|
|
6709
|
-
|
|
6710
|
-
_p = _b.
|
|
6711
|
-
|
|
6712
|
-
_q = _b.
|
|
6713
|
-
|
|
6714
|
-
_r = _b.
|
|
6715
|
-
|
|
6716
|
-
_s = _b.
|
|
6717
|
-
|
|
6728
|
+
_o = _b.nested,
|
|
6729
|
+
nested = _o === void 0 ? false : _o,
|
|
6730
|
+
_p = _b.needPanelThreshold,
|
|
6731
|
+
needPanelThreshold = _p === void 0 ? 0 : _p,
|
|
6732
|
+
_q = _b.preventEventsBeforeInit,
|
|
6733
|
+
preventEventsBeforeInit = _q === void 0 ? true : _q,
|
|
6734
|
+
_r = _b.deceleration,
|
|
6735
|
+
deceleration = _r === void 0 ? 0.0075 : _r,
|
|
6736
|
+
_s = _b.duration,
|
|
6737
|
+
duration = _s === void 0 ? 500 : _s,
|
|
6738
|
+
_t = _b.easing,
|
|
6739
|
+
easing = _t === void 0 ? function (x) {
|
|
6718
6740
|
return 1 - Math.pow(1 - x, 3);
|
|
6719
|
-
} :
|
|
6720
|
-
|
|
6721
|
-
inputType =
|
|
6722
|
-
|
|
6723
|
-
moveType =
|
|
6724
|
-
|
|
6725
|
-
threshold =
|
|
6726
|
-
|
|
6727
|
-
interruptable =
|
|
6728
|
-
|
|
6729
|
-
bounce =
|
|
6730
|
-
|
|
6731
|
-
iOSEdgeSwipeThreshold =
|
|
6732
|
-
|
|
6733
|
-
preventClickOnDrag =
|
|
6734
|
-
|
|
6735
|
-
disableOnInit =
|
|
6736
|
-
|
|
6737
|
-
renderOnlyVisible =
|
|
6738
|
-
|
|
6739
|
-
virtual =
|
|
6740
|
-
|
|
6741
|
-
autoInit =
|
|
6742
|
-
|
|
6743
|
-
autoResize =
|
|
6744
|
-
|
|
6745
|
-
useResizeObserver =
|
|
6746
|
-
|
|
6747
|
-
resizeDebounce =
|
|
6748
|
-
|
|
6749
|
-
maxResizeDebounce =
|
|
6750
|
-
|
|
6751
|
-
externalRenderer =
|
|
6752
|
-
|
|
6753
|
-
renderExternal =
|
|
6741
|
+
} : _t,
|
|
6742
|
+
_u = _b.inputType,
|
|
6743
|
+
inputType = _u === void 0 ? ["mouse", "touch"] : _u,
|
|
6744
|
+
_v = _b.moveType,
|
|
6745
|
+
moveType = _v === void 0 ? "snap" : _v,
|
|
6746
|
+
_w = _b.threshold,
|
|
6747
|
+
threshold = _w === void 0 ? 40 : _w,
|
|
6748
|
+
_x = _b.interruptable,
|
|
6749
|
+
interruptable = _x === void 0 ? true : _x,
|
|
6750
|
+
_y = _b.bounce,
|
|
6751
|
+
bounce = _y === void 0 ? "20%" : _y,
|
|
6752
|
+
_z = _b.iOSEdgeSwipeThreshold,
|
|
6753
|
+
iOSEdgeSwipeThreshold = _z === void 0 ? 30 : _z,
|
|
6754
|
+
_0 = _b.preventClickOnDrag,
|
|
6755
|
+
preventClickOnDrag = _0 === void 0 ? true : _0,
|
|
6756
|
+
_1 = _b.disableOnInit,
|
|
6757
|
+
disableOnInit = _1 === void 0 ? false : _1,
|
|
6758
|
+
_2 = _b.renderOnlyVisible,
|
|
6759
|
+
renderOnlyVisible = _2 === void 0 ? false : _2,
|
|
6760
|
+
_3 = _b.virtual,
|
|
6761
|
+
virtual = _3 === void 0 ? null : _3,
|
|
6762
|
+
_4 = _b.autoInit,
|
|
6763
|
+
autoInit = _4 === void 0 ? true : _4,
|
|
6764
|
+
_5 = _b.autoResize,
|
|
6765
|
+
autoResize = _5 === void 0 ? true : _5,
|
|
6766
|
+
_6 = _b.useResizeObserver,
|
|
6767
|
+
useResizeObserver = _6 === void 0 ? true : _6,
|
|
6768
|
+
_7 = _b.resizeDebounce,
|
|
6769
|
+
resizeDebounce = _7 === void 0 ? 0 : _7,
|
|
6770
|
+
_8 = _b.maxResizeDebounce,
|
|
6771
|
+
maxResizeDebounce = _8 === void 0 ? 100 : _8,
|
|
6772
|
+
_9 = _b.externalRenderer,
|
|
6773
|
+
externalRenderer = _9 === void 0 ? null : _9,
|
|
6774
|
+
_10 = _b.renderExternal,
|
|
6775
|
+
renderExternal = _10 === void 0 ? null : _10;
|
|
6754
6776
|
|
|
6755
6777
|
var _this = _super.call(this) || this; // Internal states
|
|
6756
6778
|
|
|
@@ -6768,6 +6790,7 @@ version: 4.6.1
|
|
|
6768
6790
|
_this._panelsPerView = panelsPerView;
|
|
6769
6791
|
_this._noPanelStyleOverride = noPanelStyleOverride;
|
|
6770
6792
|
_this._resizeOnContentsReady = resizeOnContentsReady;
|
|
6793
|
+
_this._nested = nested;
|
|
6771
6794
|
_this._virtual = virtual;
|
|
6772
6795
|
_this._needPanelThreshold = needPanelThreshold;
|
|
6773
6796
|
_this._preventEventsBeforeInit = preventEventsBeforeInit;
|
|
@@ -7241,6 +7264,24 @@ version: 4.6.1
|
|
|
7241
7264
|
enumerable: false,
|
|
7242
7265
|
configurable: true
|
|
7243
7266
|
});
|
|
7267
|
+
Object.defineProperty(__proto, "nested", {
|
|
7268
|
+
/**
|
|
7269
|
+
* 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.
|
|
7270
|
+
* If the parent Flicking and child Flicking have different horizontal option, you do not need to set this option.
|
|
7271
|
+
* @ko Flicking 내부에 Flicking이 배치될 때 하위 Flicking에서 이 옵션을 활성화하면 하위 Flicking이 첫/마지막 패널에 도달한 뒤부터 같은 방향으로 상위 Flicking이 움직입니다.
|
|
7272
|
+
* 만약 상위 Flicking과 하위 Flicking이 서로 다른 horizontal 옵션을 가지고 있다면 이 옵션을 설정할 필요가 없습니다.
|
|
7273
|
+
* @type {boolean}
|
|
7274
|
+
* @default false
|
|
7275
|
+
*/
|
|
7276
|
+
get: function () {
|
|
7277
|
+
return this._nested;
|
|
7278
|
+
},
|
|
7279
|
+
set: function (val) {
|
|
7280
|
+
this._nested = val;
|
|
7281
|
+
},
|
|
7282
|
+
enumerable: false,
|
|
7283
|
+
configurable: true
|
|
7284
|
+
});
|
|
7244
7285
|
Object.defineProperty(__proto, "needPanelThreshold", {
|
|
7245
7286
|
// EVENTS
|
|
7246
7287
|
|
|
@@ -8477,7 +8518,7 @@ version: 4.6.1
|
|
|
8477
8518
|
*/
|
|
8478
8519
|
|
|
8479
8520
|
|
|
8480
|
-
Flicking.VERSION = "4.
|
|
8521
|
+
Flicking.VERSION = "4.7.0";
|
|
8481
8522
|
return Flicking;
|
|
8482
8523
|
}(Component);
|
|
8483
8524
|
|
|
@@ -8648,7 +8689,9 @@ version: 4.6.1
|
|
|
8648
8689
|
}
|
|
8649
8690
|
}
|
|
8650
8691
|
|
|
8651
|
-
|
|
8692
|
+
if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
|
|
8693
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
8694
|
+
}
|
|
8652
8695
|
});
|
|
8653
8696
|
|
|
8654
8697
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|