Resize plugins panel.

This commit is contained in:
Julia Radzhabova 2016-08-01 11:26:08 +03:00
parent 8501cf59b0
commit 954d86022e
2 changed files with 30 additions and 0 deletions

View file

@ -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) {

View file

@ -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 || {}));