@egjs/flicking 4.6.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/declaration/control/Control.d.ts +1 -1
- package/dist/flicking.esm.js +132 -138
- package/dist/flicking.esm.js.map +1 -1
- package/dist/flicking.js +132 -138
- 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 +132 -138
- 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/cfc/sync.ts +3 -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/renderer/Renderer.ts +16 -14
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.2
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -8325,6 +8325,8 @@ version: 4.6.1
|
|
|
8325
8325
|
};
|
|
8326
8326
|
|
|
8327
8327
|
__proto.onRelease = function (ctx) {
|
|
8328
|
+
var _a;
|
|
8329
|
+
|
|
8328
8330
|
var flicking = ctx.flicking,
|
|
8329
8331
|
axesEvent = ctx.axesEvent,
|
|
8330
8332
|
transitTo = ctx.transitTo; // Update last position to cope with Axes's animating behavior
|
|
@@ -8344,7 +8346,13 @@ version: 4.6.1
|
|
|
8344
8346
|
var control = flicking.control;
|
|
8345
8347
|
var position = axesEvent.destPos[POSITION_KEY];
|
|
8346
8348
|
var duration = Math.max(axesEvent.duration, flicking.duration);
|
|
8347
|
-
|
|
8349
|
+
|
|
8350
|
+
try {
|
|
8351
|
+
void control.moveToPosition(position, duration, axesEvent);
|
|
8352
|
+
} catch (err) {
|
|
8353
|
+
transitTo(STATE_TYPE.IDLE);
|
|
8354
|
+
axesEvent.setTo((_a = {}, _a[POSITION_KEY] = flicking.camera.position, _a), 0);
|
|
8355
|
+
}
|
|
8348
8356
|
};
|
|
8349
8357
|
|
|
8350
8358
|
return DraggingState;
|
|
@@ -8420,7 +8428,11 @@ version: 4.6.1
|
|
|
8420
8428
|
direction: getDirection$1(animatingContext.start, animatingContext.end),
|
|
8421
8429
|
axesEvent: axesEvent
|
|
8422
8430
|
}));
|
|
8423
|
-
|
|
8431
|
+
var targetPanel = this._targetPanel;
|
|
8432
|
+
|
|
8433
|
+
if (targetPanel) {
|
|
8434
|
+
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted);
|
|
8435
|
+
}
|
|
8424
8436
|
};
|
|
8425
8437
|
|
|
8426
8438
|
return AnimatingState;
|
|
@@ -9175,7 +9187,7 @@ version: 4.6.1
|
|
|
9175
9187
|
*/
|
|
9176
9188
|
|
|
9177
9189
|
|
|
9178
|
-
__proto.updatePosition = function (
|
|
9190
|
+
__proto.updatePosition = function (progressInPanel) {
|
|
9179
9191
|
var flicking = getFlickingAttached(this._flicking);
|
|
9180
9192
|
var camera = flicking.camera;
|
|
9181
9193
|
var activePanel = this._activePanel;
|
|
@@ -9551,48 +9563,41 @@ version: 4.6.1
|
|
|
9551
9563
|
*/
|
|
9552
9564
|
|
|
9553
9565
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
activeAnchor = camera.findActiveAnchor();
|
|
9560
|
-
anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
9561
|
-
state = flicking.control.controller.state;
|
|
9566
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
9567
|
+
var camera = flicking.camera;
|
|
9568
|
+
var activeAnchor = camera.findActiveAnchor();
|
|
9569
|
+
var anchorAtCamera = camera.findNearestAnchor(camera.position);
|
|
9570
|
+
var state = flicking.control.controller.state;
|
|
9562
9571
|
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
9567
|
-
}
|
|
9572
|
+
if (!activeAnchor || !anchorAtCamera) {
|
|
9573
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
9574
|
+
}
|
|
9568
9575
|
|
|
9569
|
-
|
|
9570
|
-
posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
9571
|
-
absPosDelta = Math.abs(posDelta);
|
|
9572
|
-
snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
9573
|
-
|
|
9574
|
-
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
9575
|
-
// Move to anchor at position
|
|
9576
|
-
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
9577
|
-
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
9578
|
-
// Move to the adjacent panel
|
|
9579
|
-
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
9580
|
-
} else {
|
|
9581
|
-
// Restore to active panel
|
|
9582
|
-
targetAnchor = anchorAtCamera;
|
|
9583
|
-
}
|
|
9576
|
+
var snapThreshold = this._calcSnapThreshold(position, activeAnchor);
|
|
9584
9577
|
|
|
9585
|
-
|
|
9578
|
+
var posDelta = flicking.animating ? state.delta : position - camera.position;
|
|
9579
|
+
var absPosDelta = Math.abs(posDelta);
|
|
9580
|
+
var snapDelta = axesEvent && axesEvent.delta[POSITION_KEY] !== 0 ? Math.abs(axesEvent.delta[POSITION_KEY]) : absPosDelta;
|
|
9581
|
+
var targetAnchor;
|
|
9586
9582
|
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9583
|
+
if (snapDelta >= snapThreshold && snapDelta > 0) {
|
|
9584
|
+
// Move to anchor at position
|
|
9585
|
+
targetAnchor = this._findSnappedAnchor(position, anchorAtCamera);
|
|
9586
|
+
} else if (absPosDelta >= flicking.threshold && absPosDelta > 0) {
|
|
9587
|
+
// Move to the adjacent panel
|
|
9588
|
+
targetAnchor = this._findAdjacentAnchor(posDelta, anchorAtCamera);
|
|
9589
|
+
} else {
|
|
9590
|
+
// Restore to active panel
|
|
9591
|
+
targetAnchor = anchorAtCamera;
|
|
9592
|
+
}
|
|
9593
|
+
|
|
9594
|
+
this._triggerIndexChangeEvent(targetAnchor.panel, position, axesEvent);
|
|
9595
|
+
|
|
9596
|
+
return this._animateToPosition({
|
|
9597
|
+
position: camera.clampToReachablePosition(targetAnchor.position),
|
|
9598
|
+
duration: duration,
|
|
9599
|
+
newActivePanel: targetAnchor.panel,
|
|
9600
|
+
axesEvent: axesEvent
|
|
9596
9601
|
});
|
|
9597
9602
|
};
|
|
9598
9603
|
|
|
@@ -9781,35 +9786,26 @@ version: 4.6.1
|
|
|
9781
9786
|
|
|
9782
9787
|
|
|
9783
9788
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
camera = flicking.camera;
|
|
9789
|
-
targetPos = camera.clampToReachablePosition(position);
|
|
9790
|
-
anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
9789
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
9790
|
+
var camera = flicking.camera;
|
|
9791
|
+
var targetPos = camera.clampToReachablePosition(position);
|
|
9792
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(targetPos);
|
|
9791
9793
|
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
9796
|
-
}
|
|
9794
|
+
if (!anchorAtPosition) {
|
|
9795
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
9796
|
+
}
|
|
9797
9797
|
|
|
9798
|
-
|
|
9798
|
+
var targetPanel = anchorAtPosition.panel; // Trigger only change event
|
|
9799
9799
|
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9800
|
+
if (targetPanel !== this._activePanel) {
|
|
9801
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
9802
|
+
}
|
|
9803
9803
|
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
newActivePanel: targetPanel,
|
|
9810
|
-
axesEvent: axesEvent
|
|
9811
|
-
})];
|
|
9812
|
-
});
|
|
9804
|
+
return this._animateToPosition({
|
|
9805
|
+
position: this._stopAtEdge ? targetPos : position,
|
|
9806
|
+
duration: duration,
|
|
9807
|
+
newActivePanel: targetPanel,
|
|
9808
|
+
axesEvent: axesEvent
|
|
9813
9809
|
});
|
|
9814
9810
|
};
|
|
9815
9811
|
|
|
@@ -10007,62 +10003,56 @@ version: 4.6.1
|
|
|
10007
10003
|
|
|
10008
10004
|
|
|
10009
10005
|
__proto.moveToPosition = function (position, duration, axesEvent) {
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
cameraRange = camera.range;
|
|
10019
|
-
clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
10020
|
-
anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
10021
|
-
|
|
10022
|
-
if (!anchorAtPosition || !activePanel) {
|
|
10023
|
-
return [2
|
|
10024
|
-
/*return*/
|
|
10025
|
-
, Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE))];
|
|
10026
|
-
}
|
|
10006
|
+
var flicking = getFlickingAttached(this._flicking);
|
|
10007
|
+
var camera = flicking.camera;
|
|
10008
|
+
var activePanel = this._activePanel;
|
|
10009
|
+
var axesRange = this._controller.range;
|
|
10010
|
+
var indexRange = this._indexRange;
|
|
10011
|
+
var cameraRange = camera.range;
|
|
10012
|
+
var clampedPosition = clamp(camera.clampToReachablePosition(position), axesRange[0], axesRange[1]);
|
|
10013
|
+
var anchorAtPosition = camera.findAnchorIncludePosition(clampedPosition);
|
|
10027
10014
|
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10015
|
+
if (!anchorAtPosition || !activePanel) {
|
|
10016
|
+
return Promise.reject(new FlickingError(MESSAGE.POSITION_NOT_REACHABLE(position), CODE.POSITION_NOT_REACHABLE));
|
|
10017
|
+
}
|
|
10018
|
+
|
|
10019
|
+
var prevPos = activePanel.position;
|
|
10020
|
+
var isOverThreshold = Math.abs(position - prevPos) >= flicking.threshold;
|
|
10021
|
+
var adjacentAnchor = position > prevPos ? camera.getNextAnchor(anchorAtPosition) : camera.getPrevAnchor(anchorAtPosition);
|
|
10022
|
+
var targetPos;
|
|
10023
|
+
var targetPanel;
|
|
10024
|
+
var anchors = camera.anchorPoints;
|
|
10025
|
+
var firstAnchor = anchors[0];
|
|
10026
|
+
var lastAnchor = anchors[anchors.length - 1];
|
|
10027
|
+
var shouldBounceToFirst = position <= cameraRange.min && isBetween(firstAnchor.panel.index, indexRange.min, indexRange.max);
|
|
10028
|
+
var shouldBounceToLast = position >= cameraRange.max && isBetween(lastAnchor.panel.index, indexRange.min, indexRange.max);
|
|
10029
|
+
|
|
10030
|
+
if (shouldBounceToFirst || shouldBounceToLast) {
|
|
10031
|
+
// In bounce area
|
|
10032
|
+
var targetAnchor = position < cameraRange.min ? firstAnchor : lastAnchor;
|
|
10033
|
+
targetPanel = targetAnchor.panel;
|
|
10034
|
+
targetPos = targetAnchor.position;
|
|
10035
|
+
} else if (isOverThreshold && anchorAtPosition.position !== activePanel.position) {
|
|
10036
|
+
// Move to anchor at position
|
|
10037
|
+
targetPanel = anchorAtPosition.panel;
|
|
10038
|
+
targetPos = anchorAtPosition.position;
|
|
10039
|
+
} else if (isOverThreshold && adjacentAnchor && isBetween(adjacentAnchor.index, indexRange.min, indexRange.max)) {
|
|
10040
|
+
// Move to adjacent anchor
|
|
10041
|
+
targetPanel = adjacentAnchor.panel;
|
|
10042
|
+
targetPos = adjacentAnchor.position;
|
|
10043
|
+
} else {
|
|
10044
|
+
// Restore to active panel
|
|
10045
|
+
targetPos = camera.clampToReachablePosition(activePanel.position);
|
|
10046
|
+
targetPanel = activePanel;
|
|
10047
|
+
}
|
|
10054
10048
|
|
|
10055
|
-
|
|
10049
|
+
this._triggerIndexChangeEvent(targetPanel, position, axesEvent);
|
|
10056
10050
|
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
newActivePanel: targetPanel,
|
|
10063
|
-
axesEvent: axesEvent
|
|
10064
|
-
})];
|
|
10065
|
-
});
|
|
10051
|
+
return this._animateToPosition({
|
|
10052
|
+
position: targetPos,
|
|
10053
|
+
duration: duration,
|
|
10054
|
+
newActivePanel: targetPanel,
|
|
10055
|
+
axesEvent: axesEvent
|
|
10066
10056
|
});
|
|
10067
10057
|
};
|
|
10068
10058
|
|
|
@@ -12751,29 +12741,31 @@ version: 4.6.1
|
|
|
12751
12741
|
|
|
12752
12742
|
void this.render();
|
|
12753
12743
|
|
|
12754
|
-
if (!
|
|
12755
|
-
if (
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12744
|
+
if (!flicking.animating) {
|
|
12745
|
+
if (!activePanel || activePanel.removed) {
|
|
12746
|
+
if (panels.length <= 0) {
|
|
12747
|
+
// All panels removed
|
|
12748
|
+
camera.lookAt(0);
|
|
12749
|
+
} else {
|
|
12750
|
+
var targetIndex = (_a = activePanel === null || activePanel === void 0 ? void 0 : activePanel.index) !== null && _a !== void 0 ? _a : 0;
|
|
12760
12751
|
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12752
|
+
if (targetIndex > panels.length - 1) {
|
|
12753
|
+
targetIndex = panels.length - 1;
|
|
12754
|
+
}
|
|
12764
12755
|
|
|
12765
|
-
|
|
12756
|
+
void control.moveToPanel(panels[targetIndex], {
|
|
12757
|
+
duration: 0
|
|
12758
|
+
}).catch(function () {
|
|
12759
|
+
return void 0;
|
|
12760
|
+
});
|
|
12761
|
+
}
|
|
12762
|
+
} else {
|
|
12763
|
+
void control.moveToPanel(activePanel, {
|
|
12766
12764
|
duration: 0
|
|
12767
12765
|
}).catch(function () {
|
|
12768
12766
|
return void 0;
|
|
12769
12767
|
});
|
|
12770
12768
|
}
|
|
12771
|
-
} else {
|
|
12772
|
-
void control.moveToPanel(control.activePanel, {
|
|
12773
|
-
duration: 0
|
|
12774
|
-
}).catch(function () {
|
|
12775
|
-
return void 0;
|
|
12776
|
-
});
|
|
12777
12769
|
}
|
|
12778
12770
|
|
|
12779
12771
|
flicking.camera.updateOffset();
|
|
@@ -15896,7 +15888,7 @@ version: 4.6.1
|
|
|
15896
15888
|
*/
|
|
15897
15889
|
|
|
15898
15890
|
|
|
15899
|
-
Flicking.VERSION = "4.6.
|
|
15891
|
+
Flicking.VERSION = "4.6.2";
|
|
15900
15892
|
return Flicking;
|
|
15901
15893
|
}(Component$1);
|
|
15902
15894
|
|
|
@@ -16067,7 +16059,9 @@ version: 4.6.1
|
|
|
16067
16059
|
}
|
|
16068
16060
|
}
|
|
16069
16061
|
|
|
16070
|
-
|
|
16062
|
+
if (diffResult.added.length > 0 || diffResult.removed.length > 0) {
|
|
16063
|
+
renderer.updateAfterPanelChange(added, removed);
|
|
16064
|
+
}
|
|
16071
16065
|
});
|
|
16072
16066
|
|
|
16073
16067
|
var batchInsert = function (renderer, diffResult, addedElements, startIdx, endIdx) {
|