[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) {
var main_width = document.documentElement.offsetWidth;
var main_height = document.documentElement.offsetHeight;
var width = document.documentElement.offsetWidth,
height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
width = Common.Utils.innerWidth();
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') {
var win_height = parseInt(this.$window.find('.body').css('height'));
@ -245,17 +253,14 @@ define([
}
function _setVisible() {
if (window.innerHeight == undefined) {
var main_width = document.documentElement.offsetWidth;
var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
var main_geometry = _readDocumetGeometry(),
main_width = main_geometry.width,
main_height = main_geometry.height;
if (this.getLeft() + this.getWidth() > main_width)
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());
}
@ -278,13 +283,9 @@ define([
this.dragging.initx = event.pageX*zoom - this.getLeft();
this.dragging.inity = event.pageY*zoom - this.getTop();
if (window.innerHeight == undefined) {
var main_width = document.documentElement.offsetWidth;
var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
var main_geometry = _readDocumetGeometry(),
main_width = main_geometry.width,
main_height = main_geometry.height;
this.dragging.maxx = main_width - this.getWidth();
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.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(),
main_height = (window.innerHeight == undefined) ? document.documentElement.offsetHeight : Common.Utils.innerHeight(),
maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width,
var main_geometry = _readDocumetGeometry(),
main_width = main_geometry.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;
this.resizing.minw = this.initConfig.minwidth;

View file

@ -99,7 +99,7 @@ define([
},this),
'show': _.bind(function(cmp){
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) {
h = Math.min(innerHeight, 700);
this.diagramEditorView.setHeight(h);

View file

@ -216,7 +216,7 @@ Common.Utils = _.extend(new(function() {
zoom: function() {return me.zoom;},
topOffset: 0,
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 || {});

View file

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