Skip to content

Commit

Permalink
fix(useViewAnimation): 修复可重复调用cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
yue1123 committed Dec 5, 2022
1 parent d7c75a0 commit 2d2478a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/hooks/useViewAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface UseViewAnimationOptions {
type AnimationListenerType = 'animationstart' | 'animationiterations' | 'animationend' | 'animationcancel'

type AnimationStatus = 'PLAYING' | 'STOPPING' | 'INITIAL'
// FIXME: 默认值处理
// FIXME: 取消动画后再次开始动画,地图上 pio 不消失,可能是地图本身 bug
export function useViewAnimation(map: any, options: UseViewAnimationOptions) {
options = options || {}
options.disableDragging = options.disableDragging !== undefined ? false : true
Expand Down Expand Up @@ -128,7 +128,7 @@ export function useViewAnimation(map: any, options: UseViewAnimationOptions) {
}
}
const cancel = () => {
if (initd) {
if (initd && status.value !== 'INITIAL') {
;(viewAnimation as BMapGL.ViewAnimation)._cancel(mapInstance)
syncDragging()
}
Expand Down

0 comments on commit 2d2478a

Please sign in to comment.