Skip to content

Commit

Permalink
clarify activity bar action menu layout
Browse files Browse the repository at this point in the history
refs #40262
  • Loading branch information
sbatten committed Nov 2, 2020
1 parent fd9ace8 commit 3258a28
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
const accountsActions: IAction[] = [];
const accountsMenu = this.menuService.createMenu(MenuId.AccountsContext, this.contextKeyService);
const actionsDisposable = createAndFillInActionBarActions(accountsMenu, undefined, { primary: [], secondary: accountsActions });
const native = getTitleBarStyle(this.configurationService, this.environmentService) === 'native';
const customOrMac = getTitleBarStyle(this.configurationService, this.environmentService) !== 'native' || isMacintosh; // using the location logic on mac helps with #40262
const position = this.configurationService.getValue('workbench.sideBar.location');

const containerPosition = DOM.getDomNodePagePosition(this.container);
const location = { x: containerPosition.left + (position === 'left' ? containerPosition.width : 0), y: containerPosition.top };
const actions = await this.getActions(accountsMenu);
this.contextMenuService.showContextMenu({
getAnchor: () => !native ? location : e || this.container,
anchorAlignment: !native ? (position === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT) : undefined,
getAnchor: () => customOrMac ? location : e || this.container,
anchorAlignment: customOrMac ? (position === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT) : undefined,
getActions: () => actions,
onHide: () => {
accountsMenu.dispose();
Expand Down Expand Up @@ -308,14 +308,14 @@ export class GlobalActivityActionViewItem extends ActivityActionViewItem {
const globalActivityActions: IAction[] = [];
const globalActivityMenu = this.menuService.createMenu(MenuId.GlobalActivity, this.contextKeyService);
const actionsDisposable = createAndFillInActionBarActions(globalActivityMenu, undefined, { primary: [], secondary: globalActivityActions });
const native = getTitleBarStyle(this.configurationService, this.environmentService) === 'native';
const customOrMac = getTitleBarStyle(this.configurationService, this.environmentService) !== 'native' || isMacintosh; // using the location logic on mac helps with #40262
const position = this.configurationService.getValue('workbench.sideBar.location');

const containerPosition = DOM.getDomNodePagePosition(this.container);
const location = { x: containerPosition.left + (position === 'left' ? containerPosition.width : 0), y: containerPosition.top + containerPosition.height };
this.contextMenuService.showContextMenu({
getAnchor: () => !native ? location : e || this.container,
anchorAlignment: !native ? (position === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT) : undefined,
getAnchor: () => customOrMac ? location : e || this.container,
anchorAlignment: customOrMac ? (position === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT) : undefined,
getActions: () => globalActivityActions,
onHide: () => {
globalActivityMenu.dispose();
Expand Down

0 comments on commit 3258a28

Please sign in to comment.