[Menus] Reposition context menus correctly

Fix styles used to reposition context menus when they are
near the edge of the screen, so that these menus remain
both on-screen and near the user's mouse. WTD-719.
This commit is contained in:
Victor Woeltjen
2015-01-27 14:01:53 -08:00
parent 5c34382933
commit 76c38affc3
2 changed files with 34 additions and 5 deletions

View File

@ -59,10 +59,14 @@ define(
scope.domainObject = domainObject;
scope.menuStyle = {};
scope.menuStyle[goLeft ? "right" : "left"] =
eventCoors[0] + 'px';
(goLeft ? (winDim[0] - eventCoors[0]) : eventCoors[0]) + 'px';
scope.menuStyle[goUp ? "bottom" : "top"] =
eventCoors[1] + 'px';
scope.menuClass = { "go-left": goLeft, "go-up": goUp, "context-menu-holder": true };
(goUp ? (winDim[1] - eventCoors[1]) : eventCoors[1]) + 'px';
scope.menuClass = {
"go-left": goLeft,
"go-up": goUp,
"context-menu-holder": true
};
// Create the context menu
menu = $compile(MENU_TEMPLATE)(scope);