diff --git a/src/control/SnapControl.ts b/src/control/SnapControl.ts index e823303b3..a6b9370e6 100644 --- a/src/control/SnapControl.ts +++ b/src/control/SnapControl.ts @@ -95,7 +95,7 @@ class SnapControl extends Control { return Promise.reject(new FlickingError(ERROR.MESSAGE.POSITION_NOT_REACHABLE(position), ERROR.CODE.POSITION_NOT_REACHABLE)); } - const snapThreshold = this._calcSnapThreshold(position, activeAnchor); + const snapThreshold = this._calcSnapThreshold(flicking.threshold, position, activeAnchor); const posDelta = flicking.animating ? state.delta @@ -210,7 +210,7 @@ class SnapControl extends Control { return adjacentAnchor; } - private _calcSnapThreshold(position: number, activeAnchor: AnchorPoint): number { + private _calcSnapThreshold(threshold: number, position: number, activeAnchor: AnchorPoint): number { const isNextDirection = position > activeAnchor.position; const panel = activeAnchor.panel; const panelSize = panel.size; @@ -222,9 +222,9 @@ class SnapControl extends Control { * |<------>|<------------>| * [ |<-Anchor ] */ - return isNextDirection + return Math.max(threshold, isNextDirection ? panelSize - alignPos + panel.margin.next - : alignPos + panel.margin.prev; + : alignPos + panel.margin.prev); } } diff --git a/test/manual/css/index.css b/test/manual/css/index.css index 7b6d58cb1..17d59f2fd 100644 --- a/test/manual/css/index.css +++ b/test/manual/css/index.css @@ -35,6 +35,10 @@ header { background-color: #423789; } +.vertical { + height: 200px; +} + .flicking-panel { border: 10px solid transparent; box-sizing: border-box; diff --git a/test/manual/js/vertical.js b/test/manual/js/vertical.js new file mode 100644 index 000000000..d391888df --- /dev/null +++ b/test/manual/js/vertical.js @@ -0,0 +1,5 @@ +const flicking = new Flicking("#flicking", { + horizontal: false, + align: "prev", + threshold: 50, +}); diff --git a/test/manual/vertical.html b/test/manual/vertical.html new file mode 100644 index 000000000..1ea0a3a49 --- /dev/null +++ b/test/manual/vertical.html @@ -0,0 +1,30 @@ + + +
+ + + + + + + + + +