mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-02-10 18:05:32 +08:00
Fix element's layout in hidden frame
This commit is contained in:
@ -154,6 +154,9 @@ define([
|
||||
this.setVisible(action, visible);
|
||||
}, this));
|
||||
Common.NotificationCenter.on('tab:resize', _.bind(this.onResizeTabs, this));
|
||||
Common.NotificationCenter.on('app:repaint', _.bind(function() {
|
||||
this.repaintMoreBtns();
|
||||
}, this));
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
@ -613,6 +616,15 @@ define([
|
||||
this.$moreBar = btnsMore[tab].panel;
|
||||
},
|
||||
|
||||
repaintMoreBtns: function() {
|
||||
for (var btn in btnsMore) {
|
||||
if (btnsMore[btn] && btnsMore[btn].cmpEl) {
|
||||
var box = btnsMore[btn].cmpEl.closest('.more-box');
|
||||
box.css('top', Common.Utils.getPosition(box.parent()).top);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clearMoreButton: function(tab) {
|
||||
var panel = this.$panels.filter('[data-tab=' + tab + ']');
|
||||
if ( panel.length ) {
|
||||
|
||||
@ -727,6 +727,7 @@ define([
|
||||
if (me.$window && me.isVisible() && me.$window == obj.$window) me.close();
|
||||
};
|
||||
Common.NotificationCenter.on('window:close', this.binding.winclose);
|
||||
Common.NotificationCenter.on('app:repaint', _.bind(this.onAppRepaint, this));
|
||||
|
||||
this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls);
|
||||
|
||||
@ -994,6 +995,16 @@ define([
|
||||
return parseInt(this.$window.css('top'));
|
||||
},
|
||||
|
||||
setPosition: function(x, y) {
|
||||
if (this.$window) {
|
||||
if (_.isNumber(x) && _.isNumber(y)) {
|
||||
this.$window.css('left',Math.floor(x));
|
||||
this.$window.css('top',Math.floor(y));
|
||||
} else
|
||||
_centre.call(this);
|
||||
}
|
||||
},
|
||||
|
||||
isVisible: function() {
|
||||
return this.$window && this.$window.is(':visible');
|
||||
},
|
||||
@ -1039,6 +1050,18 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
onAppRepaint: function() {
|
||||
if (!this.$window || !this.isVisible()) return;
|
||||
|
||||
_autoSize.call(this);
|
||||
|
||||
if (this.initConfig.repaintcallback)
|
||||
this.initConfig.repaintcallback.call(this)
|
||||
else if (this.initConfig.repaintcallback!==false) {
|
||||
_centre.call(this);
|
||||
}
|
||||
},
|
||||
|
||||
suspendKeyEvents: function () {
|
||||
this.pauseKeyEvents = false;
|
||||
},
|
||||
|
||||
@ -129,6 +129,7 @@ define([], function () {
|
||||
Data: 5
|
||||
},
|
||||
isMobile = /android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent || navigator.vendor || window.opera),
|
||||
needRepaint = undefined,
|
||||
me = this,
|
||||
checkSize = function () {
|
||||
var scale = {};
|
||||
@ -196,6 +197,13 @@ define([], function () {
|
||||
me.innerWidth = window.innerWidth * me.zoom;
|
||||
me.innerHeight = window.innerHeight * me.zoom;
|
||||
me.applicationPixelRatio = scale.applicationPixelRatio || scale.devicePixelRatio;
|
||||
if (me.innerWidth<1 && needRepaint===undefined)
|
||||
needRepaint = true;
|
||||
else if (needRepaint && me.innerWidth>0) {
|
||||
needRepaint = false;
|
||||
Common.NotificationCenter.trigger('app:repaint');
|
||||
console.log(me.innerWidth);
|
||||
}
|
||||
},
|
||||
checkSizeIE = function () {
|
||||
me.innerWidth = window.innerWidth;
|
||||
|
||||
@ -3283,6 +3283,9 @@ define([
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
repaintcallback: function() {
|
||||
this.setPosition(Common.Utils.innerWidth() - this.options.width - 15, 30);
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.appOptions.guestName + ')' : me.textAnonymous;
|
||||
|
||||
@ -163,6 +163,10 @@ define([
|
||||
this.$el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
this.$el.show();
|
||||
|
||||
Common.NotificationCenter.on('app:repaint', _.bind(function() {
|
||||
this.$el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
}, this));
|
||||
|
||||
var $markup = $(this.template({scope: this}));
|
||||
this.$el.html($markup);
|
||||
|
||||
|
||||
@ -2529,6 +2529,9 @@ define([
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
repaintcallback: function() {
|
||||
this.setPosition(Common.Utils.innerWidth() - this.options.width - 15, 30);
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.appOptions.guestName + ')' : me.textAnonymous;
|
||||
|
||||
@ -152,6 +152,10 @@ define([
|
||||
// el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
el.show();
|
||||
|
||||
Common.NotificationCenter.on('app:repaint', function() {
|
||||
el.css('width', SCALE_MIN + 'px');
|
||||
});
|
||||
|
||||
el.html(this.template({scope: this}));
|
||||
|
||||
this.btnMoreContainer = $('#slot-right-menu-more');
|
||||
|
||||
@ -2734,6 +2734,9 @@ define([
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
repaintcallback: function() {
|
||||
this.setPosition(Common.Utils.innerWidth() - this.options.width - 15, 30);
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.textGuest + ')' : me.textAnonymous;
|
||||
|
||||
@ -162,6 +162,10 @@ define([
|
||||
el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
el.show();
|
||||
|
||||
Common.NotificationCenter.on('app:repaint', function() {
|
||||
el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
});
|
||||
|
||||
el.html(this.template({scope: this}));
|
||||
|
||||
this.btnMoreContainer = $('#slot-right-menu-more');
|
||||
|
||||
@ -3406,6 +3406,9 @@ define([
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
repaintcallback: function() {
|
||||
this.setPosition(Common.Utils.innerWidth() - this.options.width - 15, 30);
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.textGuest + ')' : me.textAnonymous;
|
||||
|
||||
@ -188,6 +188,10 @@ define([
|
||||
el.css('z-index', 101);
|
||||
el.show();
|
||||
|
||||
Common.NotificationCenter.on('app:repaint', function() {
|
||||
el.css('width', ((open) ? MENU_SCALE_PART : SCALE_MIN) + 'px');
|
||||
});
|
||||
|
||||
el.html(this.template({scope: this}));
|
||||
|
||||
this.btnMoreContainer = $('#slot-right-menu-more');
|
||||
|
||||
@ -1922,6 +1922,9 @@ define([
|
||||
validation: function(value) {
|
||||
return value.length<128 ? true : me.textLongName;
|
||||
},
|
||||
repaintcallback: function() {
|
||||
this.setPosition(Common.Utils.innerWidth() - this.options.width - 15, 30);
|
||||
},
|
||||
handler: function(result, settings) {
|
||||
if (result == 'ok') {
|
||||
var name = settings.input ? settings.input + ' (' + me.appOptions.guestName + ')' : me.textAnonymous;
|
||||
|
||||
Reference in New Issue
Block a user