From c421ea70f5fceddd648a84474272931fda61ddd6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Nov 2017 17:10:25 +0300 Subject: [PATCH] Fix Bug 36264. Refactoring mouseup event outside of the browser window. --- apps/common/main/lib/component/Layout.js | 2 +- apps/common/main/lib/component/TabBar.js | 5 +++-- apps/common/main/lib/component/Window.js | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/Layout.js b/apps/common/main/lib/component/Layout.js index 698e5ff39..9b07c7c5c 100644 --- a/apps/common/main/lib/component/Layout.js +++ b/apps/common/main/lib/component/Layout.js @@ -168,11 +168,11 @@ define([ this.splitters.push({resizer:resizer}); panel.resize.hidden && resizer.el.hide(); + Common.Gateway.on('processmouse', this.resize.eventStop); } }, this); this.freeze = options.freeze; this.freeze && this.freezePanels(this.freeze); - Common.Gateway.on('processmouse', this.resize.eventStop); }, doLayout: function() { diff --git a/apps/common/main/lib/component/TabBar.js b/apps/common/main/lib/component/TabBar.js index 0018b965e..81db94966 100644 --- a/apps/common/main/lib/component/TabBar.js +++ b/apps/common/main/lib/component/TabBar.js @@ -207,7 +207,7 @@ define([ function dragComplete() { if (!_.isUndefined(me.drag)) { me.drag.tab.$el.css('z-index', ''); - + me.bar.dragging = false; var tab = null; for (var i = me.bar.tabs.length - 1; i >= 0; --i) { tab = me.bar.tabs[i].$el; @@ -254,6 +254,7 @@ define([ _clientX = e.clientX*Common.Utils.zoom(); me.bar = bar; me.drag = {tab: tab, index: index}; + bar.dragging = true; this.calculateBounds(); this.setAbsTabs(); @@ -365,7 +366,7 @@ define([ }, onProcessMouse: function(data) { - if (data.type == 'mouseup') { + if (data.type == 'mouseup' && this.dragging) { var tab = this.getActive(true); if (tab) tab.mouseup(); diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index 9a6cbef9e..acfec692b 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -294,6 +294,13 @@ define([ } } + function _onProcessMouse(data) { + if (data.type == 'mouseup' && this.dragging.enabled) { + _mouseup.call(this); + } + } + + /* window resize functions */ function _resizestart(event) { Common.UI.Menu.Manager.hideAll(); @@ -580,6 +587,9 @@ define([ }; this.$window.find('.header').on('mousedown', this.binding.dragStart); this.$window.find('.tool.close').on('click', _.bind(doclose, this)); + + if (!this.initConfig.modal) + Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this)); } else { this.$window.find('.body').css({ top:0,