Commit b475bb5f authored by Julia Radzhabova's avatar Julia Radzhabova

Debugging resizable plugins.

parent bc0a3bff
...@@ -226,7 +226,9 @@ define([ ...@@ -226,7 +226,9 @@ define([
var me = this, var me = this,
arrBtns = variation.get_Buttons(), arrBtns = variation.get_Buttons(),
newBtns = {}, newBtns = {},
size = variation.get_Size(); size = variation.get_Size(),
maxsize = variation.get_MaximumSize(),
minsize = variation.get_MinimumSize();
if (!size || size.length<2) size = [800, 600]; if (!size || size.length<2) size = [800, 600];
if (_.isArray(arrBtns)) { if (_.isArray(arrBtns)) {
...@@ -242,7 +244,11 @@ define([ ...@@ -242,7 +244,11 @@ define([
height: size[1], // inner height height: size[1], // inner height
url: _baseUrl + variation.get_Url(), url: _baseUrl + variation.get_Url(),
buttons: newBtns, buttons: newBtns,
toolcallback: _.bind(this.onToolClose, this) toolcallback: _.bind(this.onToolClose, this),
maxwidth: maxsize[0],
maxheight: maxsize[1],
minwidth: minsize[0],
minheight: minsize[1]
}); });
me.pluginDlg.on('render:after', function(obj){ me.pluginDlg.on('render:after', function(obj){
obj.getChild('.footer .dlg-btn').on('click', _.bind(me.onDlgBtnClick, me)); obj.getChild('.footer .dlg-btn').on('click', _.bind(me.onDlgBtnClick, me));
...@@ -251,6 +257,8 @@ define([ ...@@ -251,6 +257,8 @@ define([
me.pluginDlg = undefined; me.pluginDlg = undefined;
}).on('drag', function(args){ }).on('drag', function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start'); me.api.asc_pluginEnableMouseEvents(args[1]=='start');
}).on('resize', function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start');
}); });
me.pluginDlg.show(); me.pluginDlg.show();
} }
...@@ -286,7 +294,8 @@ define([ ...@@ -286,7 +294,8 @@ define([
onPluginMouseUp: function(x, y) { onPluginMouseUp: function(x, y) {
if (this.pluginDlg) { if (this.pluginDlg) {
this.pluginDlg.binding.dragStop(); if (this.pluginDlg.binding.dragStop) this.pluginDlg.binding.dragStop();
if (this.pluginDlg.binding.resizeStop) this.pluginDlg.binding.resizeStop();
} else } else
Common.NotificationCenter.trigger('frame:mouseup', jQuery.Event("mouseup", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } )); Common.NotificationCenter.trigger('frame:mouseup', jQuery.Event("mouseup", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } ));
}, },
...@@ -294,7 +303,8 @@ define([ ...@@ -294,7 +303,8 @@ define([
onPluginMouseMove: function(x, y) { onPluginMouseMove: function(x, y) {
if (this.pluginDlg) { if (this.pluginDlg) {
var offset = this.pluginContainer.offset(); var offset = this.pluginContainer.offset();
this.pluginDlg.binding.drag(jQuery.Event("mousemove", { pageX: x+offset.left, pageY: y+offset.top } )); if (this.pluginDlg.binding.drag) this.pluginDlg.binding.drag(jQuery.Event("mousemove", { pageX: x+offset.left, pageY: y+offset.top } ));
if (this.pluginDlg.binding.resize) this.pluginDlg.binding.resize(jQuery.Event("mousemove", { pageX: x+offset.left, pageY: y+offset.top } ));
} else } else
Common.NotificationCenter.trigger('frame:mousemove', jQuery.Event("mousemove", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } )); Common.NotificationCenter.trigger('frame:mousemove', jQuery.Event("mousemove", { pageX: x+this._moveOffset.x, pageY: y+this._moveOffset.y } ));
} }
......
...@@ -230,6 +230,10 @@ define([ ...@@ -230,6 +230,10 @@ define([
Common.UI.Window.prototype.render.call(this); Common.UI.Window.prototype.render.call(this);
this.$window.find('> .body').css({height: 'auto', overflow: 'hidden'}); this.$window.find('> .body').css({height: 'auto', overflow: 'hidden'});
this.boxEl = this.$window.find('.body > .box');
this._headerFooterHeight = (this.options.buttons && _.size(this.options.buttons)>0) ? 85 : 34;
this._headerFooterHeight += ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))));
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
iframe.id = 'plugin_iframe'; iframe.id = 'plugin_iframe';
iframe.name = 'pluginFrameEditor', iframe.name = 'pluginFrameEditor',
...@@ -251,6 +255,10 @@ define([ ...@@ -251,6 +255,10 @@ define([
iframe.src = this.url; iframe.src = this.url;
$('#id-plugin-placeholder').append(iframe); $('#id-plugin-placeholder').append(iframe);
this.on('resizing', function(args){
me.boxEl.css('height', parseInt(me.$window.css('height')) - me._headerFooterHeight);
});
}, },
_onLoad: function() { _onLoad: function() {
...@@ -262,23 +270,19 @@ define([ ...@@ -262,23 +270,19 @@ define([
setInnerSize: function(width, height) { setInnerSize: function(width, height) {
var maxHeight = parseInt(window.innerHeight), var maxHeight = parseInt(window.innerHeight),
maxWidth = parseInt(window.innerWidth), maxWidth = parseInt(window.innerWidth),
header_footer = (this.options.buttons && _.size(this.options.buttons)>0) ? 85 : 34,
borders_height = (parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))),
borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width'))); borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width')));
if (maxHeight<height + header_footer + borders_height) if (maxHeight<height + this._headerFooterHeight)
height = maxHeight - header_footer - borders_height; height = maxHeight - this._headerFooterHeight;
if (maxWidth<width + borders_width) if (maxWidth<width + borders_width)
width = maxWidth - borders_width; width = maxWidth - borders_width;
var $window = this.getChild(); this.boxEl.css('height', height);
var boxEl = $window.find('.body > .box');
boxEl.css('height', height);
Common.UI.Window.prototype.setHeight.call(this, height + header_footer + borders_height); Common.UI.Window.prototype.setHeight.call(this, height + this._headerFooterHeight);
Common.UI.Window.prototype.setWidth.call(this, width + borders_width); Common.UI.Window.prototype.setWidth.call(this, width + borders_width);
this.$window.css('left',(maxWidth - width - borders_width) / 2); this.$window.css('left',(maxWidth - width - borders_width) / 2);
this.$window.css('top',((maxHeight - height - header_footer - borders_height) / 2) * 0.9); this.$window.css('top',((maxHeight - height - this._headerFooterHeight) / 2) * 0.9);
}, },
textLoading : 'Loading' textLoading : 'Loading'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment