File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/core/components/toolbar Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ export const initTabbarHighlight = (el) => {
8383
8484 if ( e . type === 'pointerdown' ) {
8585 data . linkEls = el . querySelectorAll ( '.tab-link' ) ;
86+ data . activeIndex = [ ...data . linkEls ] . findIndex ( ( link ) =>
87+ link . classList . contains ( 'tab-link-active' ) ,
88+ ) ;
8689 data . rect = toolbarPaneEl . getBoundingClientRect ( ) ;
8790 data . touched = true ;
8891 setHighlightOnTouch ( data , e ) ;
@@ -100,6 +103,18 @@ export const initTabbarHighlight = (el) => {
100103 unsetHighlightOnTouch ( data ) ;
101104 stopAnimation ( data ) ;
102105 }
106+ if ( e . type === 'pointercancel' ) {
107+ if ( ! data . touched ) return ;
108+ data . touched = false ;
109+ data . moved = false ;
110+ data . setTransform = null ;
111+ stopAnimation ( data ) ;
112+ if ( highlightEl ) {
113+ highlightEl . classList . remove ( 'tab-link-highlight-pressed' ) ;
114+ highlightEl . style . transform = `translateX(${ data . activeIndex * 100 } %)` ;
115+ highlightEl . style . transitionTimingFunction = '' ;
116+ }
117+ }
103118 } ;
104119 el . addEventListener ( 'touchstart' , el . f7ToolbarOnPointer , { passive : false } ) ;
105120 el . addEventListener ( 'pointerdown' , el . f7ToolbarOnPointer , { passive : false } ) ;
You can’t perform that action at this time.
0 commit comments