fix menus and dialogs in fullscreen mode

This commit is contained in:
j 2019-02-21 16:10:58 +05:30
parent 28cc45485a
commit b8a46dbee4
6 changed files with 8 additions and 5 deletions

View file

@ -110,6 +110,7 @@ Ox.Fullscreen = (function() {
// FIXME: Why does storing the function in a variable not work? // FIXME: Why does storing the function in a variable not work?
// enter && enter(); // enter && enter();
// ^ Missing `this` binding // ^ Missing `this` binding
that.element = element
}; };
that.exit = function() { that.exit = function() {
@ -123,6 +124,7 @@ Ox.Fullscreen = (function() {
// FIXME: Why does storing the function in a variable not work? // FIXME: Why does storing the function in a variable not work?
// exit && exit(); // exit && exit();
// ^ Missing `this` binding // ^ Missing `this` binding
delete that.element
}; };
that.getState = function() { that.getState = function() {

View file

@ -95,7 +95,7 @@ Ox.Picker = function(options, self) {
.css({ .css({
borderRadius: '8px 8px 0 0' borderRadius: '8px 8px 0 0'
}); });
self.$layer.appendTo(Ox.$body); self.$layer.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
self.$menu self.$menu
.css({ .css({
left: left + 'px', left: left + 'px',

View file

@ -826,8 +826,9 @@ Ox.Menu = function(options, self) {
if (!that.is(':hidden')) { if (!that.is(':hidden')) {
return; return;
} }
that.parent().length == 0 && that.appendTo(Ox.$body); that.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
that.css({ that.css({
position: 'fixed',
left: '-1000px', left: '-1000px',
top: '-1000px' top: '-1000px'
}).show(); }).show();

View file

@ -70,7 +70,7 @@ Ox.Dialog = function(options, self) {
} }
}) })
.hide() .hide()
.appendTo(Ox.$body); .appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
self.hasButtons = !!self.options.buttons.length; self.hasButtons = !!self.options.buttons.length;
self.barsHeight = 24 + 24 * self.hasButtons; self.barsHeight = 24 + 24 * self.hasButtons;

View file

@ -55,7 +55,7 @@ Ox.Layer = function(options, self) {
if (self.options.type == 'dialog') { if (self.options.type == 'dialog') {
Ox.$window.on({mouseup: mouseup}); Ox.$window.on({mouseup: mouseup});
} }
that.appendTo(Ox.$body); that.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
return that; return that;
} }

View file

@ -79,7 +79,7 @@ Ox.Tooltip = function(options, self) {
self.y = y; self.y = y;
} }
$('.OxTooltip').detach(); // fixme: don't use DOM $('.OxTooltip').detach(); // fixme: don't use DOM
that.appendTo(Ox.$body); that.appendTo(Ox.Fullscreen.element ? Ox.Fullscreen.element : Ox.$body);
width = that.width(); width = that.width();
height = that.height(); height = that.height();
left = Ox.limit( left = Ox.limit(