@egjs/flicking
Advanced tools
Comparing version 4.6.1 to 4.6.2
@@ -22,3 +22,3 @@ import { OnRelease } from "@egjs/axes"; | ||
disable(): this; | ||
updatePosition(_progressInPanel: number): void; | ||
updatePosition(progressInPanel: number): void; | ||
updateInput(): this; | ||
@@ -25,0 +25,0 @@ resetActive(): this; |
{ | ||
"name": "@egjs/flicking", | ||
"version": "4.6.1", | ||
"version": "4.6.2", | ||
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.", | ||
@@ -5,0 +5,0 @@ "main": "dist/flicking.js", |
@@ -88,3 +88,5 @@ import { DiffResult } from "@egjs/list-differ"; | ||
renderer.updateAfterPanelChange(added, removed); | ||
if (diffResult.added.length > 0 || diffResult.removed.length > 0) { | ||
renderer.updateAfterPanelChange(added, removed); | ||
} | ||
}; | ||
@@ -91,0 +93,0 @@ |
@@ -174,3 +174,3 @@ /* | ||
*/ | ||
public updatePosition(_progressInPanel: number): void { // eslint-disable-line @typescript-eslint/no-unused-vars | ||
public updatePosition(progressInPanel: number): void { // eslint-disable-line @typescript-eslint/no-unused-vars | ||
const flicking = getFlickingAttached(this._flicking); | ||
@@ -325,3 +325,3 @@ const camera = flicking.camera; | ||
protected _triggerIndexChangeEvent(panel: Panel, position: number, axesEvent?: OnRelease): void { | ||
protected _triggerIndexChangeEvent(panel: Panel, position: number, axesEvent?: OnRelease) { | ||
const flicking = getFlickingAttached(this._flicking); | ||
@@ -328,0 +328,0 @@ const triggeringEvent = panel !== this._activePanel ? EVENTS.WILL_CHANGE : EVENTS.WILL_RESTORE; |
@@ -109,3 +109,3 @@ /* | ||
*/ | ||
public async moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
public moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
const flicking = getFlickingAttached(this._flicking); | ||
@@ -112,0 +112,0 @@ |
@@ -87,3 +87,3 @@ /* | ||
*/ | ||
public async moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
public moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
const flicking = getFlickingAttached(this._flicking); | ||
@@ -90,0 +90,0 @@ const camera = flicking.camera; |
@@ -68,3 +68,6 @@ /* | ||
control.setActive(this._targetPanel!, control.activePanel, axesEvent.isTrusted); | ||
const targetPanel = this._targetPanel; | ||
if (targetPanel) { | ||
control.setActive(targetPanel, control.activePanel, axesEvent.isTrusted); | ||
} | ||
} | ||
@@ -71,0 +74,0 @@ } |
@@ -37,3 +37,3 @@ /* | ||
public onRelease(ctx: Parameters<State["onRelease"]>[0]): void { | ||
public onRelease(ctx: Parameters<State["onRelease"]>[0]) { | ||
const { flicking, axesEvent, transitTo } = ctx; | ||
@@ -59,3 +59,8 @@ | ||
void control.moveToPosition(position, duration, axesEvent); | ||
try { | ||
void control.moveToPosition(position, duration, axesEvent); | ||
} catch (err) { | ||
transitTo(STATE_TYPE.IDLE); | ||
axesEvent.setTo({ [AXES.POSITION_KEY]: flicking.camera.position }, 0); | ||
} | ||
} | ||
@@ -62,0 +67,0 @@ } |
@@ -190,3 +190,3 @@ /* | ||
*/ | ||
public async moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
public moveToPosition(position: number, duration: number, axesEvent?: OnRelease) { | ||
const flicking = getFlickingAttached(this._flicking); | ||
@@ -193,0 +193,0 @@ const camera = flicking.camera; |
@@ -340,20 +340,22 @@ /* | ||
if (!activePanel || activePanel.removed) { | ||
if (panels.length <= 0) { | ||
// All panels removed | ||
camera.lookAt(0); | ||
if (!flicking.animating) { | ||
if (!activePanel || activePanel.removed) { | ||
if (panels.length <= 0) { | ||
// All panels removed | ||
camera.lookAt(0); | ||
} else { | ||
let targetIndex = activePanel?.index ?? 0; | ||
if (targetIndex > panels.length - 1) { | ||
targetIndex = panels.length - 1; | ||
} | ||
void control.moveToPanel(panels[targetIndex], { | ||
duration: 0 | ||
}).catch(() => void 0); | ||
} | ||
} else { | ||
let targetIndex = activePanel?.index ?? 0; | ||
if (targetIndex > panels.length - 1) { | ||
targetIndex = panels.length - 1; | ||
} | ||
void control.moveToPanel(panels[targetIndex], { | ||
void control.moveToPanel(activePanel, { | ||
duration: 0 | ||
}).catch(() => void 0); | ||
} | ||
} else { | ||
void control.moveToPanel(control.activePanel!, { | ||
duration: 0 | ||
}).catch(() => void 0); | ||
} | ||
@@ -360,0 +362,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3815917
39003