@egjs/flicking 4.6.2 → 4.6.3
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/camera/mode/CameraMode.d.ts +1 -0
- package/declaration/camera/mode/CircularCameraMode.d.ts +1 -0
- package/dist/flicking.esm.js +48 -21
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +48 -21
- 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 +48 -21
- 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 +1 -1
- 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/control/StrictControl.ts +7 -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.6.
|
|
7
|
+
version: 4.6.3
|
|
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')) :
|
|
@@ -3614,6 +3614,7 @@ version: 4.6.2
|
|
|
3614
3614
|
var lastAnchor = anchors[anchors.length - 1];
|
|
3615
3615
|
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3616
3616
|
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
3617
|
+
var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
|
|
3617
3618
|
|
|
3618
3619
|
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
3619
3620
|
// In bounce area
|
|
@@ -3624,7 +3625,7 @@ version: 4.6.2
|
|
|
3624
3625
|
// Move to anchor at position
|
|
3625
3626
|
targetPanel = anchorAtPosition.panel;
|
|
3626
3627
|
targetPos = anchorAtPosition.position;
|
|
3627
|
-
} else if (isOverThreshold &&
|
|
3628
|
+
} else if (isOverThreshold && isAdjacent) {
|
|
3628
3629
|
// Move to adjacent anchor
|
|
3629
3630
|
targetPanel = adjacentAnchor.panel;
|
|
3630
3631
|
targetPos = adjacentAnchor.position;
|
|
@@ -3711,6 +3712,27 @@ version: 4.6.2
|
|
|
3711
3712
|
}, null);
|
|
3712
3713
|
};
|
|
3713
3714
|
|
|
3715
|
+
__proto.findNearestAnchor = function (position) {
|
|
3716
|
+
var anchors = this._flicking.camera.anchorPoints;
|
|
3717
|
+
if (anchors.length <= 0) return null;
|
|
3718
|
+
var prevDist = Infinity;
|
|
3719
|
+
|
|
3720
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3721
|
+
var anchor = anchors[anchorIdx];
|
|
3722
|
+
var dist = Math.abs(anchor.position - position);
|
|
3723
|
+
|
|
3724
|
+
if (dist > prevDist) {
|
|
3725
|
+
// Return previous anchor
|
|
3726
|
+
return anchors[anchorIdx - 1];
|
|
3727
|
+
}
|
|
3728
|
+
|
|
3729
|
+
prevDist = dist;
|
|
3730
|
+
} // Return last anchor
|
|
3731
|
+
|
|
3732
|
+
|
|
3733
|
+
return anchors[anchors.length - 1];
|
|
3734
|
+
};
|
|
3735
|
+
|
|
3714
3736
|
__proto.clampToReachablePosition = function (position) {
|
|
3715
3737
|
var camera = this._flicking.camera;
|
|
3716
3738
|
var range = camera.range;
|
|
@@ -3840,6 +3862,28 @@ version: 4.6.2
|
|
|
3840
3862
|
});
|
|
3841
3863
|
};
|
|
3842
3864
|
|
|
3865
|
+
__proto.findNearestAnchor = function (position) {
|
|
3866
|
+
var camera = this._flicking.camera;
|
|
3867
|
+
var anchors = camera.anchorPoints;
|
|
3868
|
+
if (anchors.length <= 0) return null;
|
|
3869
|
+
var camRange = camera.range;
|
|
3870
|
+
var minDist = Infinity;
|
|
3871
|
+
var minDistIndex = -1;
|
|
3872
|
+
|
|
3873
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
3874
|
+
var anchor = anchors[anchorIdx];
|
|
3875
|
+
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));
|
|
3876
|
+
|
|
3877
|
+
if (dist < minDist) {
|
|
3878
|
+
minDist = dist;
|
|
3879
|
+
minDistIndex = anchorIdx;
|
|
3880
|
+
}
|
|
3881
|
+
} // Return last anchor
|
|
3882
|
+
|
|
3883
|
+
|
|
3884
|
+
return anchors[minDistIndex];
|
|
3885
|
+
};
|
|
3886
|
+
|
|
3843
3887
|
__proto.findAnchorIncludePosition = function (position) {
|
|
3844
3888
|
var camera = this._flicking.camera;
|
|
3845
3889
|
var range = camera.range;
|
|
@@ -4608,24 +4652,7 @@ version: 4.6.2
|
|
|
4608
4652
|
|
|
4609
4653
|
|
|
4610
4654
|
__proto.findNearestAnchor = function (position) {
|
|
4611
|
-
|
|
4612
|
-
if (anchors.length <= 0) return null;
|
|
4613
|
-
var prevDist = Infinity;
|
|
4614
|
-
|
|
4615
|
-
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
4616
|
-
var anchor = anchors[anchorIdx];
|
|
4617
|
-
var dist = Math.abs(anchor.position - position);
|
|
4618
|
-
|
|
4619
|
-
if (dist > prevDist) {
|
|
4620
|
-
// Return previous anchor
|
|
4621
|
-
return anchors[anchorIdx - 1];
|
|
4622
|
-
}
|
|
4623
|
-
|
|
4624
|
-
prevDist = dist;
|
|
4625
|
-
} // Return last anchor
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
return anchors[anchors.length - 1];
|
|
4655
|
+
return this._mode.findNearestAnchor(position);
|
|
4629
4656
|
};
|
|
4630
4657
|
/**
|
|
4631
4658
|
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
@@ -8469,7 +8496,7 @@ version: 4.6.2
|
|
|
8469
8496
|
*/
|
|
8470
8497
|
|
|
8471
8498
|
|
|
8472
|
-
Flicking.VERSION = "4.6.
|
|
8499
|
+
Flicking.VERSION = "4.6.3";
|
|
8473
8500
|
return Flicking;
|
|
8474
8501
|
}(Component);
|
|
8475
8502
|
|