From 954d86022e2ae0ebcb2579c810de6aab55b3fca7 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 1 Aug 2016 11:26:08 +0300 Subject: [PATCH] Resize plugins panel. --- apps/common/main/lib/component/Layout.js | 7 +++++++ apps/common/main/lib/controller/Plugins.js | 23 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/apps/common/main/lib/component/Layout.js b/apps/common/main/lib/component/Layout.js index f3d161366..4ef9ac6a8 100644 --- a/apps/common/main/lib/component/Layout.js +++ b/apps/common/main/lib/component/Layout.js @@ -172,6 +172,11 @@ define([ }, this); this.freeze = options.freeze; this.freeze && this.freezePanels(this.freeze); + + Common.NotificationCenter.on({ + 'frame:mouseMove': this.resize.eventMove, + 'frame:mouseup': this.resize.eventStop + }); }, doLayout: function() { @@ -251,6 +256,7 @@ define([ this.resize.max = (panel.maxpos > 0 ? panel.maxpos : this.resize.$el.parent().height() + panel.maxpos) - this.resize.width; this.resize.initx = e.pageX - parseInt(e.currentTarget.style.left); } + Common.NotificationCenter.trigger('layout:resizestart'); }, resizeMove: function(e) { @@ -331,6 +337,7 @@ define([ this.doLayout(); this.trigger('layout:resizedrag', this); } + Common.NotificationCenter.trigger('layout:resizestop'); }, freezePanels: function (value) { diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index 44bc41f0f..8edf884cf 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -74,6 +74,8 @@ define([ this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.onPluginShow, this)); this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.onPluginClose, this)); this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this)); + this.api.asc_registerCallback("asc_onPluginMouseUp", _.bind(this.onPluginMouseUp, this)); + this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); return this; }, @@ -88,6 +90,19 @@ define([ onAfterRender: function(panelPlugins) { panelPlugins.viewPluginsList.on('item:click', _.bind(this.onSelectPlugin, this)); this.bindViewEvents(this.panelPlugins, this.events); + var me = this; + Common.NotificationCenter.on({ + 'layout:resizestart': function(e){ + if (me.panelPlugins.isVisible()) { + me.api.asc_pluginEnableMouseEvents(true); + } + }, + 'layout:resizestop': function(e){ + if (me.panelPlugins.isVisible()) { + me.api.asc_pluginEnableMouseEvents(false); + } + } + }); }, updatePluginsList: function() { @@ -249,6 +264,14 @@ define([ onToolClose: function() { this.api.asc_pluginButtonClick(-1); + }, + + onPluginMouseUp: function(e) { + Common.NotificationCenter.trigger('frame:mouseup', e); + }, + + onPluginMouseMove: function(e) { + Common.NotificationCenter.trigger('frame:mousemove', e); } }, Common.Controllers.Plugins || {}));