mirror of
https://github.com/nasa/openmct.git
synced 2024-12-18 20:57:53 +00:00
[Selection] Position context menus
This commit is contained in:
parent
f926bd9762
commit
c9a0a469f6
@ -6,13 +6,25 @@ define(['zepto'], function ($) {
|
||||
|
||||
OverlayManager.prototype.show = function (view, x, y) {
|
||||
var $container = $('<div></div>');
|
||||
var w = this.$body.width();
|
||||
var h = this.$body.height();
|
||||
|
||||
x = x || 0;
|
||||
y = y || 0;
|
||||
|
||||
$container.css('position', 'absolute');
|
||||
|
||||
if (x < w / 2) {
|
||||
$container.css('left', x + 'px');
|
||||
} else {
|
||||
$container.css('right', (w - x) + 'px');
|
||||
}
|
||||
|
||||
if (x < h / 2) {
|
||||
$container.css('top', y + 'px');
|
||||
} else {
|
||||
$container.css('bottom', (h - y) + 'px');
|
||||
}
|
||||
|
||||
view.show($container[0]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user