[desktop] fix bug 45005

This commit is contained in:
Maxim Kadushkin 2020-04-21 17:03:04 +03:00
parent 7bd2011e08
commit c462bd6ddb
4 changed files with 29 additions and 26 deletions

View file

@ -219,14 +219,22 @@ define([
} }
} }
function _centre() { function _readDocumetGeometry() {
if (window.innerHeight == undefined) { if (window.innerHeight == undefined) {
var main_width = document.documentElement.offsetWidth; var width = document.documentElement.offsetWidth,
var main_height = document.documentElement.offsetHeight; height = document.documentElement.offsetHeight;
} else { } else {
main_width = Common.Utils.innerWidth(); width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight(); height = Common.Utils.innerHeight();
} }
height -= Common.Utils.InternalSettings.get('window-inactive-area-top');
return {width: width, height: height, top: Common.Utils.InternalSettings.get('window-inactive-area-top')};
}
function _centre() {
var main_geometry = _readDocumetGeometry(),
main_width = main_geometry.width,
main_height = main_geometry.height;
if (this.initConfig.height == 'auto') { if (this.initConfig.height == 'auto') {
var win_height = parseInt(this.$window.find('.body').css('height')); var win_height = parseInt(this.$window.find('.body').css('height'));
@ -245,17 +253,14 @@ define([
} }
function _setVisible() { function _setVisible() {
if (window.innerHeight == undefined) { var main_geometry = _readDocumetGeometry(),
var main_width = document.documentElement.offsetWidth; main_width = main_geometry.width,
var main_height = document.documentElement.offsetHeight; main_height = main_geometry.height;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
if (this.getLeft() + this.getWidth() > main_width) if (this.getLeft() + this.getWidth() > main_width)
this.$window.css('left', main_width - this.getWidth()); this.$window.css('left', main_width - this.getWidth());
if (this.getTop() + this.getHeight() > main_height) var _top = this.getTop() - main_geometry.top;
if (_top + this.getHeight() > main_height)
this.$window.css('top', main_height - this.getHeight()); this.$window.css('top', main_height - this.getHeight());
} }
@ -278,13 +283,9 @@ define([
this.dragging.initx = event.pageX*zoom - this.getLeft(); this.dragging.initx = event.pageX*zoom - this.getLeft();
this.dragging.inity = event.pageY*zoom - this.getTop(); this.dragging.inity = event.pageY*zoom - this.getTop();
if (window.innerHeight == undefined) { var main_geometry = _readDocumetGeometry(),
var main_width = document.documentElement.offsetWidth; main_width = main_geometry.width,
var main_height = document.documentElement.offsetHeight; main_height = main_geometry.height;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
this.dragging.maxx = main_width - this.getWidth(); this.dragging.maxx = main_width - this.getWidth();
this.dragging.maxy = main_height - this.getHeight() + Common.Utils.InternalSettings.get('window-inactive-area-top'); this.dragging.maxy = main_height - this.getHeight() + Common.Utils.InternalSettings.get('window-inactive-area-top');
@ -345,9 +346,10 @@ define([
this.resizing.inith = this.getHeight(); this.resizing.inith = this.getHeight();
this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)]; this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)];
var main_width = (window.innerHeight == undefined) ? document.documentElement.offsetWidth : Common.Utils.innerWidth(), var main_geometry = _readDocumetGeometry(),
main_height = (window.innerHeight == undefined) ? document.documentElement.offsetHeight : Common.Utils.innerHeight(), main_width = main_geometry.width,
maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width, main_height = main_geometry.height;
var maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width,
maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height; maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height;
this.resizing.minw = this.initConfig.minwidth; this.resizing.minw = this.initConfig.minwidth;

View file

@ -99,7 +99,7 @@ define([
},this), },this),
'show': _.bind(function(cmp){ 'show': _.bind(function(cmp){
var h = this.diagramEditorView.getHeight(), var h = this.diagramEditorView.getHeight(),
innerHeight = Common.Utils.innerHeight(); innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
if (innerHeight>h && h<700 || innerHeight<h) { if (innerHeight>h && h<700 || innerHeight<h) {
h = Math.min(innerHeight, 700); h = Math.min(innerHeight, 700);
this.diagramEditorView.setHeight(h); this.diagramEditorView.setHeight(h);

View file

@ -216,7 +216,7 @@ Common.Utils = _.extend(new(function() {
zoom: function() {return me.zoom;}, zoom: function() {return me.zoom;},
topOffset: 0, topOffset: 0,
innerWidth: function() {return me.innerWidth;}, innerWidth: function() {return me.innerWidth;},
innerHeight: function() {return me.innerHeight - Common.Utils.InternalSettings.get('window-inactive-area-top');} innerHeight: function() {return me.innerHeight;}
} }
})(), Common.Utils || {}); })(), Common.Utils || {});

View file

@ -45,10 +45,11 @@ define([
Common.Views.ExternalDiagramEditor = Common.UI.Window.extend(_.extend({ Common.Views.ExternalDiagramEditor = Common.UI.Window.extend(_.extend({
initialize : function(options) { initialize : function(options) {
var _options = {}; var _options = {};
var _inner_height = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
_.extend(_options, { _.extend(_options, {
title: this.textTitle, title: this.textTitle,
width: 910, width: 910,
height: (Common.Utils.innerHeight()-700)<0 ? Common.Utils.innerHeight(): 700, height: (_inner_height - 700)<0 ? _inner_height : 700,
cls: 'advanced-settings-dlg', cls: 'advanced-settings-dlg',
header: true, header: true,
toolclose: 'hide', toolclose: 'hide',