Fix issue with centering wide dialogs

This commit is contained in:
JannisX11 2021-03-18 22:15:54 +01:00
parent 2a6b597e55
commit 1d7b70b483

View File

@ -452,8 +452,6 @@ window.Dialog = class Dialog {
handle: ".dialog_handle",
containment: '#page_wrapper'
})
var x = Math.clamp((window.innerWidth-540)/2, 0, 2000)
jq_dialog.css('left', x+'px')
jq_dialog.css('position', 'absolute')
}
return this;
@ -478,6 +476,10 @@ window.Dialog = class Dialog {
if (this.width) {
jq_dialog.css('width', this.width+'px');
}
if (this.draggable !== false) {
var x = Math.clamp((window.innerWidth-this.object.clientWidth)/2, 0, 2000)
jq_dialog.css('left', x+'px')
}
if (!Blockbench.isTouch) {
let first_focus = jq_dialog.find('.focusable_input').first();
if (first_focus) first_focus.trigger('focus');