@@ -8,7 +8,7 @@ import { Gesture, EventType as GestureEventType } from 'vs/base/browser/touch';
88import { ActionRunner , IAction , IActionRunner } from 'vs/base/common/actions' ;
99import { BaseActionItem , IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar' ;
1010import { IDisposable } from 'vs/base/common/lifecycle' ;
11- import { IContextViewProvider , IAnchor } from 'vs/base/browser/ui/contextview/contextview' ;
11+ import { IContextViewProvider , IAnchor , AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview' ;
1212import { IMenuOptions } from 'vs/base/browser/ui/menu/menu' ;
1313import { ResolvedKeybinding , KeyCode } from 'vs/base/common/keyCodes' ;
1414import { EventHelper , EventType , removeClass , addClass , append , $ , addDisposableListener , addClasses } from 'vs/base/browser/dom' ;
@@ -249,7 +249,8 @@ export class DropdownMenu extends BaseDropdown {
249249 getKeyBinding : action => this . menuOptions && this . menuOptions . getKeyBinding ? this . menuOptions . getKeyBinding ( action ) : null ,
250250 getMenuClassName : ( ) => this . menuClassName ,
251251 onHide : ( ) => this . onHide ( ) ,
252- actionRunner : this . menuOptions ? this . menuOptions . actionRunner : null
252+ actionRunner : this . menuOptions ? this . menuOptions . actionRunner : null ,
253+ anchorAlignment : this . menuOptions . anchorAlignment
253254 } ) ;
254255 }
255256
@@ -270,10 +271,11 @@ export class DropdownMenuActionItem extends BaseActionItem {
270271 private actionItemProvider : IActionItemProvider ;
271272 private keybindings : ( action : IAction ) => ResolvedKeybinding ;
272273 private clazz : string ;
274+ private anchorAlignmentProvider : ( ) => AnchorAlignment ;
273275
274- constructor ( action : IAction , menuActions : IAction [ ] , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string ) ;
275- constructor ( action : IAction , actionProvider : IActionProvider , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string ) ;
276- constructor ( action : IAction , menuActionsOrProvider : any , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string ) {
276+ constructor ( action : IAction , menuActions : IAction [ ] , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) ;
277+ constructor ( action : IAction , actionProvider : IActionProvider , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) ;
278+ constructor ( action : IAction , menuActionsOrProvider : any , contextMenuProvider : IContextMenuProvider , actionItemProvider : IActionItemProvider , actionRunner : IActionRunner , keybindings : ( action : IAction ) => ResolvedKeybinding , clazz : string , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) {
277279 super ( null , action ) ;
278280
279281 this . menuActionsOrProvider = menuActionsOrProvider ;
@@ -282,6 +284,7 @@ export class DropdownMenuActionItem extends BaseActionItem {
282284 this . actionRunner = actionRunner ;
283285 this . keybindings = keybindings ;
284286 this . clazz = clazz ;
287+ this . anchorAlignmentProvider = anchorAlignmentProvider ;
285288 }
286289
287290 render ( container : HTMLElement ) : void {
@@ -311,11 +314,15 @@ export class DropdownMenuActionItem extends BaseActionItem {
311314
312315 this . dropdownMenu = this . _register ( new DropdownMenu ( container , options ) ) ;
313316
317+ const that = this ;
314318 this . dropdownMenu . menuOptions = {
315319 actionItemProvider : this . actionItemProvider ,
316320 actionRunner : this . actionRunner ,
317321 getKeyBinding : this . keybindings ,
318- context : this . _context
322+ context : this . _context ,
323+ get anchorAlignment ( ) : AnchorAlignment {
324+ return that . anchorAlignmentProvider ( ) ;
325+ }
319326 } ;
320327 }
321328
0 commit comments