Merge branch 'feature/sse-ole-resize' into feature/sse-internal-resize
This commit is contained in:
commit
8ddb38a5b8
|
@ -98,11 +98,13 @@ define([
|
||||||
'drag': _.bind(function(o, state){
|
'drag': _.bind(function(o, state){
|
||||||
externalEditor && externalEditor.serviceCommand('window:drag', state == 'start');
|
externalEditor && externalEditor.serviceCommand('window:drag', state == 'start');
|
||||||
},this),
|
},this),
|
||||||
|
'resize': _.bind(function(o, state){
|
||||||
|
externalEditor && externalEditor.serviceCommand('window:resize', state == 'start');
|
||||||
|
},this),
|
||||||
'show': _.bind(function(cmp){
|
'show': _.bind(function(cmp){
|
||||||
var h = this.oleEditorView.getHeight(),
|
var h = this.oleEditorView.getHeight(),
|
||||||
innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
|
innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
|
||||||
if (innerHeight>h && h<700 || innerHeight<h) {
|
if (innerHeight<h) {
|
||||||
h = Math.min(innerHeight, 700);
|
|
||||||
this.oleEditorView.setHeight(h);
|
this.oleEditorView.setHeight(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,12 +226,20 @@ define([
|
||||||
if (eventData.type == "processMouse") {
|
if (eventData.type == "processMouse") {
|
||||||
if (eventData.data.event == 'mouse:up') {
|
if (eventData.data.event == 'mouse:up') {
|
||||||
this.oleEditorView.binding.dragStop();
|
this.oleEditorView.binding.dragStop();
|
||||||
|
if (this.oleEditorView.binding.resizeStop) this.oleEditorView.binding.resizeStop();
|
||||||
} else
|
} else
|
||||||
if (eventData.data.event == 'mouse:move') {
|
if (eventData.data.event == 'mouse:move') {
|
||||||
var x = parseInt(this.oleEditorView.$window.css('left')) + eventData.data.pagex,
|
var x = parseInt(this.oleEditorView.$window.css('left')) + eventData.data.pagex,
|
||||||
y = parseInt(this.oleEditorView.$window.css('top')) + eventData.data.pagey + 34;
|
y = parseInt(this.oleEditorView.$window.css('top')) + eventData.data.pagey + 34;
|
||||||
this.oleEditorView.binding.drag({pageX:x, pageY:y});
|
this.oleEditorView.binding.drag({pageX:x, pageY:y});
|
||||||
|
if (this.oleEditorView.binding.resize) this.oleEditorView.binding.resize({pageX:x, pageY:y});
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
if (eventData.type == "resize") {
|
||||||
|
var w = eventData.data.width,
|
||||||
|
h = eventData.data.height;
|
||||||
|
if (w>0 && h>0)
|
||||||
|
this.oleEditorView.setInnerSize(w, h);
|
||||||
} else
|
} else
|
||||||
this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);
|
this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,19 @@ define([
|
||||||
title: this.textTitle,
|
title: this.textTitle,
|
||||||
width: 910,
|
width: 910,
|
||||||
height: (_inner_height - 700)<0 ? _inner_height : 700,
|
height: (_inner_height - 700)<0 ? _inner_height : 700,
|
||||||
|
minwidth: 880,
|
||||||
|
minheight: 275,
|
||||||
cls: 'advanced-settings-dlg',
|
cls: 'advanced-settings-dlg',
|
||||||
header: true,
|
header: true,
|
||||||
toolclose: 'hide',
|
toolclose: 'hide',
|
||||||
toolcallback: _.bind(this.onToolClose, this)
|
toolcallback: _.bind(this.onToolClose, this),
|
||||||
|
resizable: true
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
this._headerFooterHeight = 85;
|
||||||
|
|
||||||
this.template = [
|
this.template = [
|
||||||
'<div id="id-ole-editor-container" class="box" style="height:' + (_options.height-85) + 'px;">',
|
'<div id="id-ole-editor-container" class="box" style="height:' + (_options.height-this._headerFooterHeight) + 'px; padding: 0 5px;">',
|
||||||
'<div id="id-ole-editor-placeholder" style="width: 100%;height: 100%;"></div>',
|
'<div id="id-ole-editor-placeholder" style="width: 100%;height: 100%;"></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div class="separator horizontal"></div>',
|
'<div class="separator horizontal"></div>',
|
||||||
|
@ -77,6 +82,7 @@ define([
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
Common.UI.Window.prototype.render.call(this);
|
Common.UI.Window.prototype.render.call(this);
|
||||||
|
this.boxEl = this.$window.find('.body > .box');
|
||||||
|
|
||||||
this.btnSave = new Common.UI.Button({
|
this.btnSave = new Common.UI.Button({
|
||||||
el: $('#id-btn-ole-editor-apply'),
|
el: $('#id-btn-ole-editor-apply'),
|
||||||
|
@ -139,16 +145,41 @@ define([
|
||||||
var header_height = (this.initConfig.header) ? parseInt(this.$window.find('> .header').css('height')) : 0;
|
var header_height = (this.initConfig.header) ? parseInt(this.$window.find('> .header').css('height')) : 0;
|
||||||
|
|
||||||
this.$window.find('> .body').css('height', height-header_height);
|
this.$window.find('> .body').css('height', height-header_height);
|
||||||
this.$window.find('> .body > .box').css('height', height-85);
|
this.$window.find('> .body > .box').css('height', height-this._headerFooterHeight);
|
||||||
|
|
||||||
var top = (Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top') - parseInt(height)) / 2;
|
|
||||||
var left = (Common.Utils.innerWidth() - parseInt(this.initConfig.width)) / 2;
|
|
||||||
|
|
||||||
this.$window.css('left',left);
|
|
||||||
this.$window.css('top', Common.Utils.InternalSettings.get('window-inactive-area-top') + top);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setInCenter: function() {
|
||||||
|
var height = this.$window.height(),
|
||||||
|
top = (Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top') - parseInt(height)) / 2,
|
||||||
|
left = (Common.Utils.innerWidth() - parseInt(this.initConfig.width)) / 2;
|
||||||
|
|
||||||
|
this.$window.css('left',left);
|
||||||
|
this.$window.css('top', Common.Utils.InternalSettings.get('window-inactive-area-top') + top);
|
||||||
|
},
|
||||||
|
|
||||||
|
setInnerSize: function(width, height) {
|
||||||
|
var maxHeight = Common.Utils.innerHeight(),
|
||||||
|
maxWidth = Common.Utils.innerWidth(),
|
||||||
|
borders_width = (parseInt(this.$window.css('border-left-width')) + parseInt(this.$window.css('border-right-width'))),
|
||||||
|
paddings = (parseInt(this.boxEl.css('padding-left')) + parseInt(this.boxEl.css('padding-right')));
|
||||||
|
height += 90; // add toolbar and statusbar height
|
||||||
|
if (maxHeight<height + this._headerFooterHeight)
|
||||||
|
height = maxHeight - this._headerFooterHeight;
|
||||||
|
if (maxWidth<width + paddings + borders_width)
|
||||||
|
width = maxWidth - paddings - borders_width;
|
||||||
|
|
||||||
|
this.boxEl.css('height', height);
|
||||||
|
|
||||||
|
this.setHeight(height + this._headerFooterHeight);
|
||||||
|
this.setWidth(width + paddings + borders_width);
|
||||||
|
|
||||||
|
if (this.getLeft()<0)
|
||||||
|
this.$window.css('left', 0);
|
||||||
|
if (this.getTop() < Common.Utils.InternalSettings.get('window-inactive-area-top') )
|
||||||
|
this.$window.css('top', Common.Utils.InternalSettings.get('window-inactive-area-top'));
|
||||||
|
},
|
||||||
|
|
||||||
setPlaceholder: function(placeholder) {
|
setPlaceholder: function(placeholder) {
|
||||||
this._placeholder = placeholder;
|
this._placeholder = placeholder;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ define([
|
||||||
Common.Gateway.internalMessage('processMouse', {event: 'mouse:up'});
|
Common.Gateway.internalMessage('processMouse', {event: 'mouse:up'});
|
||||||
})
|
})
|
||||||
.mousemove($.proxy(function(e){
|
.mousemove($.proxy(function(e){
|
||||||
if (this.isDiagramDrag) {
|
if (this.isDiagramDrag || this.isDiagramResize) {
|
||||||
Common.Gateway.internalMessage('processMouse', {event: 'mouse:move', pagex: e.pageX*Common.Utils.zoom(), pagey: e.pageY*Common.Utils.zoom()});
|
Common.Gateway.internalMessage('processMouse', {event: 'mouse:move', pagex: e.pageX*Common.Utils.zoom(), pagey: e.pageY*Common.Utils.zoom()});
|
||||||
}
|
}
|
||||||
},this));
|
},this));
|
||||||
|
@ -2572,6 +2572,9 @@ define([
|
||||||
case 'window:drag':
|
case 'window:drag':
|
||||||
this.isDiagramDrag = data.data;
|
this.isDiagramDrag = data.data;
|
||||||
break;
|
break;
|
||||||
|
case 'window:resize':
|
||||||
|
this.isDiagramResize = data.data;
|
||||||
|
break;
|
||||||
case 'processmouse':
|
case 'processmouse':
|
||||||
this.onProcessMouse(data.data);
|
this.onProcessMouse(data.data);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue