@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.pkgd.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() :
|
|
@@ -10026,6 +10026,7 @@ version: 4.6.2
|
|
|
10026
10026
|
var lastAnchor = anchors[anchors.length - 1];
|
|
10027
10027
|
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
10028
10028
|
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
10029
|
+
var isAdjacent = adjacentAnchor && (indexRange.min <= indexRange.max ? isBetween(adjacentAnchor.index, indexRange.min, indexRange.max) : adjacentAnchor.index >= indexRange.min || adjacentAnchor.index <= indexRange.max);
|
|
10029
10030
|
|
|
10030
10031
|
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
10031
10032
|
// In bounce area
|
|
@@ -10036,7 +10037,7 @@ version: 4.6.2
|
|
|
10036
10037
|
// Move to anchor at position
|
|
10037
10038
|
targetPanel = anchorAtPosition.panel;
|
|
10038
10039
|
targetPos = anchorAtPosition.position;
|
|
10039
|
-
} else if (isOverThreshold &&
|
|
10040
|
+
} else if (isOverThreshold && isAdjacent) {
|
|
10040
10041
|
// Move to adjacent anchor
|
|
10041
10042
|
targetPanel = adjacentAnchor.panel;
|
|
10042
10043
|
targetPos = adjacentAnchor.position;
|
|
@@ -10123,6 +10124,27 @@ version: 4.6.2
|
|
|
10123
10124
|
}, null);
|
|
10124
10125
|
};
|
|
10125
10126
|
|
|
10127
|
+
__proto.findNearestAnchor = function (position) {
|
|
10128
|
+
var anchors = this._flicking.camera.anchorPoints;
|
|
10129
|
+
if (anchors.length <= 0) return null;
|
|
10130
|
+
var prevDist = Infinity;
|
|
10131
|
+
|
|
10132
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
10133
|
+
var anchor = anchors[anchorIdx];
|
|
10134
|
+
var dist = Math.abs(anchor.position - position);
|
|
10135
|
+
|
|
10136
|
+
if (dist > prevDist) {
|
|
10137
|
+
// Return previous anchor
|
|
10138
|
+
return anchors[anchorIdx - 1];
|
|
10139
|
+
}
|
|
10140
|
+
|
|
10141
|
+
prevDist = dist;
|
|
10142
|
+
} // Return last anchor
|
|
10143
|
+
|
|
10144
|
+
|
|
10145
|
+
return anchors[anchors.length - 1];
|
|
10146
|
+
};
|
|
10147
|
+
|
|
10126
10148
|
__proto.clampToReachablePosition = function (position) {
|
|
10127
10149
|
var camera = this._flicking.camera;
|
|
10128
10150
|
var range = camera.range;
|
|
@@ -10252,6 +10274,28 @@ version: 4.6.2
|
|
|
10252
10274
|
});
|
|
10253
10275
|
};
|
|
10254
10276
|
|
|
10277
|
+
__proto.findNearestAnchor = function (position) {
|
|
10278
|
+
var camera = this._flicking.camera;
|
|
10279
|
+
var anchors = camera.anchorPoints;
|
|
10280
|
+
if (anchors.length <= 0) return null;
|
|
10281
|
+
var camRange = camera.range;
|
|
10282
|
+
var minDist = Infinity;
|
|
10283
|
+
var minDistIndex = -1;
|
|
10284
|
+
|
|
10285
|
+
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
10286
|
+
var anchor = anchors[anchorIdx];
|
|
10287
|
+
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));
|
|
10288
|
+
|
|
10289
|
+
if (dist < minDist) {
|
|
10290
|
+
minDist = dist;
|
|
10291
|
+
minDistIndex = anchorIdx;
|
|
10292
|
+
}
|
|
10293
|
+
} // Return last anchor
|
|
10294
|
+
|
|
10295
|
+
|
|
10296
|
+
return anchors[minDistIndex];
|
|
10297
|
+
};
|
|
10298
|
+
|
|
10255
10299
|
__proto.findAnchorIncludePosition = function (position) {
|
|
10256
10300
|
var camera = this._flicking.camera;
|
|
10257
10301
|
var range = camera.range;
|
|
@@ -11020,24 +11064,7 @@ version: 4.6.2
|
|
|
11020
11064
|
|
|
11021
11065
|
|
|
11022
11066
|
__proto.findNearestAnchor = function (position) {
|
|
11023
|
-
|
|
11024
|
-
if (anchors.length <= 0) return null;
|
|
11025
|
-
var prevDist = Infinity;
|
|
11026
|
-
|
|
11027
|
-
for (var anchorIdx = 0; anchorIdx < anchors.length; anchorIdx++) {
|
|
11028
|
-
var anchor = anchors[anchorIdx];
|
|
11029
|
-
var dist = Math.abs(anchor.position - position);
|
|
11030
|
-
|
|
11031
|
-
if (dist > prevDist) {
|
|
11032
|
-
// Return previous anchor
|
|
11033
|
-
return anchors[anchorIdx - 1];
|
|
11034
|
-
}
|
|
11035
|
-
|
|
11036
|
-
prevDist = dist;
|
|
11037
|
-
} // Return last anchor
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
return anchors[anchors.length - 1];
|
|
11067
|
+
return this._mode.findNearestAnchor(position);
|
|
11041
11068
|
};
|
|
11042
11069
|
/**
|
|
11043
11070
|
* Return {@link AnchorPoint} that matches {@link Flicking#currentPanel}
|
|
@@ -15888,7 +15915,7 @@ version: 4.6.2
|
|
|
15888
15915
|
*/
|
|
15889
15916
|
|
|
15890
15917
|
|
|
15891
|
-
Flicking.VERSION = "4.6.
|
|
15918
|
+
Flicking.VERSION = "4.6.3";
|
|
15892
15919
|
return Flicking;
|
|
15893
15920
|
}(Component$1);
|
|
15894
15921
|
|