diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 69f7ec9be..0d2a153c8 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -239,13 +239,14 @@ define([ if (this.initConfig.height == 'auto') { var win_height = parseInt(this.$window.find('.body').css('height')); this.initConfig.header && (win_height += parseInt(this.$window.find('.header').css('height'))); - } else + } else { win_height = this.initConfig.height; + win_height > main_height && (win_height = main_height); + } var win_width = (this.initConfig.width=='auto') ? parseInt(this.$window.find('.body').css('width')) : this.initConfig.width; - var top = Common.Utils.InternalSettings.get('window-inactive-area-top') + - Math.floor((parseInt(main_height) - parseInt(win_height)) / 2); + var top = main_geometry.top + Math.floor((parseInt(main_height) - parseInt(win_height)) / 2); var left = Math.floor((parseInt(main_width) - parseInt(win_width)) / 2); this.$window.css('left',left); @@ -259,9 +260,15 @@ define([ if (this.getLeft() + this.getWidth() > main_width) this.$window.css('left', main_width - this.getWidth()); - var _top = this.getTop() - main_geometry.top; - if (_top + this.getHeight() > main_height) - this.$window.css('top', main_height - this.getHeight()); + + if (this.getTop() < main_geometry.top ) + this.$window.css('top', main_geometry.top); + else + if (this.getTop() + this.getHeight() > main_height) { + if (main_height - this.getHeight() < 0) + this.$window.css('top', main_geometry.top); + else this.$window.css('top', main_geometry.top + main_height - this.getHeight()); + } } function _getTransformation(end) { @@ -288,7 +295,10 @@ define([ 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'); + this.dragging.maxy = main_height - this.getHeight(); + if (this.dragging.maxy < 0) + this.dragging.maxy = 0; + this.dragging.maxy += main_geometry.top; $(document).on('mousemove', this.binding.drag); $(document).on('mouseup', this.binding.dragStop); diff --git a/apps/common/main/lib/view/ExternalDiagramEditor.js b/apps/common/main/lib/view/ExternalDiagramEditor.js index d2f4f3c47..4a2856281 100644 --- a/apps/common/main/lib/view/ExternalDiagramEditor.js +++ b/apps/common/main/lib/view/ExternalDiagramEditor.js @@ -141,7 +141,7 @@ define([ this.$window.find('> .body').css('height', height-header_height); this.$window.find('> .body > .box').css('height', height-85); - var top = (Common.Utils.innerHeight() - parseInt(height)) / 2; + var top = (Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top') - parseInt(height)) / 2; var left = (Common.Utils.innerWidth() - parseInt(this.initConfig.width)) / 2; this.$window.css('left',left);