File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " mapbox-gl-contextmenu" ,
3- "version" : " 1.0.9 " ,
3+ "version" : " 1.0.10 " ,
44 "description" : " A contextmenu plugin for Mapbox GL JS" ,
55 "type" : " module" ,
66 "main" : " ./dist/index.cjs" ,
1717 },
1818 "scripts" : {
1919 "dev" : " vite" ,
20+ "dev:tailwind" : " vite --config vite.config.tailwind.ts" ,
2021 "build" : " tsc -p tsconfig.build.json && vite build" ,
2122 "preview" : " vite preview" ,
2223 "docs" : " typedoc"
Original file line number Diff line number Diff line change 22 --context-menu-bg : #141414 ;
33 --context-menu-shadow : 0 2px 8px rgba (0 , 0 , 0 , 0.3 );
44 --context-menu-item-text-color : white ;
5- --context-menu-item-hover -bg : #444444 ;
5+ --context-menu-item-focus -bg : #444444 ;
66 --context-menu-item-active-bg : #2a2a2a ;
77 --context-menu-item-disabled-opacity : 0.5 ;
88 --context-menu-separator-color : #505050 ;
2727 --context-menu-shadow : 0 2px 8px rgba (0 , 0 , 0 , 0.15 );
2828 --context-menu-item-font-size : 13px ;
2929 --context-menu-item-text-color : black ;
30- --context-menu-item-hover -bg : #e8e8e8 ;
30+ --context-menu-item-focus -bg : #e8e8e8 ;
3131 --context-menu-item-active-bg : #f3f3f3 ;
3232 --context-menu-item-disabled-opacity : 0.5 ;
3333 --context-menu-separator-color : #e8e8e8 ;
Original file line number Diff line number Diff line change 1717 align-items : center ;
1818 gap : 12px ;
1919 width : 100% ;
20- height : 28px ;
20+ height : var ( --context-menu-button-height , 28px ) ;
2121 padding : 0px 4px 0px 12px ;
2222 margin : 0 ;
2323 border : none ;
24- border-radius : 3px ;
24+ border-radius : var ( --context-menu-button-radius , 3px ) ;
2525 background : none ;
2626 color : var (--context-menu-item-text-color );
2727 text-align : left ;
3333 font-size : var (--context-menu-item-font-size );
3434
3535 & .focused :not (:disabled ):not (.focusedParent ) {
36- background-color : var (--context-menu-item-hover -bg );
36+ background-color : var (--context-menu-item-focus -bg );
3737 }
3838
3939 & .focusedParent :not (:disabled ) {
Original file line number Diff line number Diff line change @@ -287,13 +287,14 @@ export default class ContextMenuSubmenu extends ContextMenuItem {
287287
288288 const submenuEl = this . _submenu . menuElement ;
289289 if ( submenuEl ) {
290- // Get the first item's top padding to align submenu item with parent item
290+ // Calculate offset from menu top to first item top to align with parent
291291 const firstChild = submenuEl . firstElementChild as HTMLElement | null ;
292- const firstChildPaddingTop = firstChild
293- ? parseFloat ( getComputedStyle ( firstChild ) . paddingTop )
294- : 0 ;
292+ const menuTop = submenuEl . getBoundingClientRect ( ) . top ;
293+ const firstChildTop = firstChild
294+ ? firstChild . getBoundingClientRect ( ) . top
295+ : menuTop ;
295296
296- y -= firstChildPaddingTop ;
297+ y -= firstChildTop - menuTop ;
297298
298299 const submenuWidth = submenuEl . offsetWidth ;
299300 const submenuHeight = submenuEl . offsetHeight ;
You can’t perform that action at this time.
0 commit comments