From 586d26619f7ebfcfbde4a60c72510e1ce672e839 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Sun, 15 Mar 2020 18:13:29 +0300 Subject: [PATCH] [desktop] fix bug 42729 --- apps/common/main/lib/component/Window.js | 8 +++++--- apps/common/main/lib/controller/Desktop.js | 4 ++++ apps/common/main/lib/util/utils.js | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 0f4583993..b95e68223 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -236,7 +236,8 @@ define([ var win_width = (this.initConfig.width=='auto') ? parseInt(this.$window.find('.body').css('width')) : this.initConfig.width; - var top = Math.floor((parseInt(main_height) - parseInt(win_height)) / 2); + var top = Common.Utils.InternalSettings.get('window-inactive-area-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); @@ -311,10 +312,11 @@ define([ if (this.dragging.enabled) { var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1, left = event.pageX*zoom - this.dragging.initx, - top = event.pageY*zoom - this.dragging.inity; + top = event.pageY*zoom - this.dragging.inity, + topedge = Common.Utils.InternalSettings.get('window-inactive-area-top'); left < 0 ? (left = 0) : left > this.dragging.maxx && (left = this.dragging.maxx); - top < 0 ? (top = 0) : top > this.dragging.maxy && (top = this.dragging.maxy); + top < topedge ? (top = topedge) : top > this.dragging.maxy && (top = this.dragging.maxy); this.$window.css({left: left, top: top}); } diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index 76c8f6aec..cc91856dc 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -87,6 +87,10 @@ define([ Common.NotificationCenter.trigger('app:config', {canUndock:true}); } } + + if (_.isNumber(obj.skiptoparea)) { + Common.Utils.InternalSettings.set('window-inactive-area-top', obj.skiptoparea); + } } else if (/window:status/.test(cmd)) { var obj = JSON.parse(param); diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 50e6430b7..d56c856c6 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -214,8 +214,9 @@ Common.Utils = _.extend(new(function() { documentSettingsType: documentSettingsType, importTextType: importTextType, zoom: function() {return me.zoom;}, + topOffset: 0, innerWidth: function() {return me.innerWidth;}, - innerHeight: function() {return me.innerHeight;} + innerHeight: function() {return me.innerHeight - Common.Utils.InternalSettings.get('window-inactive-area-top');} } })(), Common.Utils || {}); @@ -891,6 +892,7 @@ Common.Utils.InternalSettings.set('toolbar-height-tabs', 32); Common.Utils.InternalSettings.set('toolbar-height-tabs-top-title', 28); Common.Utils.InternalSettings.set('toolbar-height-controls', 67); Common.Utils.InternalSettings.set('document-title-height', 28); +Common.Utils.InternalSettings.set('window-inactive-area-top', 0); Common.Utils.InternalSettings.set('toolbar-height-compact', Common.Utils.InternalSettings.get('toolbar-height-tabs')); Common.Utils.InternalSettings.set('toolbar-height-normal', Common.Utils.InternalSettings.get('toolbar-height-tabs') + Common.Utils.InternalSettings.get('toolbar-height-controls'));