Debug resizing plugin left panel and moving plugin modal window.

This commit is contained in:
Julia Radzhabova 2016-08-01 16:25:59 +03:00
parent 9403710f56
commit c1ac28bf8e
2 changed files with 29 additions and 7 deletions

View file

@ -172,11 +172,6 @@ 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() {
@ -236,6 +231,11 @@ define([
mouseup : this.resize.eventStop
});
Common.NotificationCenter.on({
'frame:mousemove': this.resize.eventMove,
'frame:mouseup': this.resize.eventStop
});
var panel = e.data.panel;
this.resize.type = e.data.type;
this.resize.$el = panel.el;
@ -289,6 +289,13 @@ define([
mouseup : this.resize.eventStop
});
Common.NotificationCenter.off({
'frame:mousemove': this.resize.eventMove,
'frame:mouseup': this.resize.eventStop
});
if (!this.resize.$el) return;
if (this.resize.type == 'vertical') {
var prop = 'height';
var value = e.pageY - this.resize.inity;

View file

@ -66,6 +66,8 @@ define([
storePlugins: this.getApplication().getCollection('Common.Collections.Plugins')
});
this.panelPlugins.on('render:after', _.bind(this.onAfterRender, this));
this._moveOffset = {x:0, y:0};
},
setApi: function(api) {
@ -94,6 +96,9 @@ define([
Common.NotificationCenter.on({
'layout:resizestart': function(e){
if (me.panelPlugins.isVisible()) {
var offset = me.panelPlugins.currentPluginFrame.offset();
me._moveOffset = {x: offset.left + parseInt(me.panelPlugins.currentPluginFrame.css('padding-left')),
y: offset.top + parseInt(me.panelPlugins.currentPluginFrame.css('padding-top'))};
me.api.asc_pluginEnableMouseEvents(true);
}
},
@ -235,8 +240,11 @@ define([
});
me.pluginDlg.on('render:after', function(obj){
obj.getChild('.footer .dlg-btn').on('click', _.bind(me.onDlgBtnClick, me));
me.pluginContainer = me.pluginDlg.$window.find('#id-plugin-container');
}).on('close', function(obj){
me.pluginDlg = undefined;
}).on('drag', function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
});
me.pluginDlg.show();
}
@ -267,11 +275,18 @@ define([
},
onPluginMouseUp: function(x, y) {
Common.NotificationCenter.trigger('frame:mouseup', jQuery.Event("mouseup", { pageX: x, pageY: y } ));
if (this.pluginDlg) {
this.pluginDlg.binding.dragStop();
} else
Common.NotificationCenter.trigger('frame:mouseup', jQuery.Event("mouseup", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } ));
},
onPluginMouseMove: function(x, y) {
Common.NotificationCenter.trigger('frame:mousemove', jQuery.Event("mousemove", { pageX: x, pageY: y } ));
if (this.pluginDlg) {
var offset = this.pluginContainer.offset();
this.pluginDlg.binding.drag(jQuery.Event("mousemove", { pageX: x+offset.left, pageY: y+offset.top } ));
} else
Common.NotificationCenter.trigger('frame:mousemove', jQuery.Event("mousemove", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } ));
}
}, Common.Controllers.Plugins || {}));