Resize ole editor
This commit is contained in:
parent
4341ea35c9
commit
0c040cec70
|
@ -98,12 +98,16 @@ define([
|
|||
'drag': _.bind(function(o, state){
|
||||
externalEditor && externalEditor.serviceCommand('window:drag', state == 'start');
|
||||
},this),
|
||||
'resize': _.bind(function(o, state){
|
||||
externalEditor && externalEditor.serviceCommand('window:resize', state == 'start');
|
||||
},this),
|
||||
'show': _.bind(function(cmp){
|
||||
var h = this.oleEditorView.getHeight(),
|
||||
innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
|
||||
if (innerHeight>h && h<700 || innerHeight<h) {
|
||||
h = Math.min(innerHeight, 700);
|
||||
this.oleEditorView.setHeight(h);
|
||||
this.oleEditorView.setInCenter();
|
||||
}
|
||||
|
||||
if (externalEditor) {
|
||||
|
@ -224,11 +228,13 @@ define([
|
|||
if (eventData.type == "processMouse") {
|
||||
if (eventData.data.event == 'mouse:up') {
|
||||
this.oleEditorView.binding.dragStop();
|
||||
this.oleEditorView.binding.resizeStop();
|
||||
} else
|
||||
if (eventData.data.event == 'mouse:move') {
|
||||
var x = parseInt(this.oleEditorView.$window.css('left')) + eventData.data.pagex,
|
||||
y = parseInt(this.oleEditorView.$window.css('top')) + eventData.data.pagey + 34;
|
||||
this.oleEditorView.binding.drag({pageX:x, pageY:y});
|
||||
this.oleEditorView.binding.resize && this.oleEditorView.binding.resize({pageX:x, pageY:y});
|
||||
}
|
||||
} else
|
||||
this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);
|
||||
|
|
|
@ -50,14 +50,17 @@ define([
|
|||
title: this.textTitle,
|
||||
width: 910,
|
||||
height: (_inner_height - 700)<0 ? _inner_height : 700,
|
||||
minwidth: 355,
|
||||
minheight: 280,
|
||||
cls: 'advanced-settings-dlg',
|
||||
header: true,
|
||||
toolclose: 'hide',
|
||||
toolcallback: _.bind(this.onToolClose, this)
|
||||
toolcallback: _.bind(this.onToolClose, this),
|
||||
resizable: true
|
||||
}, options);
|
||||
|
||||
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-85) + 'px; padding: 0 5px;">',
|
||||
'<div id="id-ole-editor-placeholder" style="width: 100%;height: 100%;"></div>',
|
||||
'</div>',
|
||||
'<div class="separator horizontal"></div>',
|
||||
|
@ -140,15 +143,18 @@ define([
|
|||
|
||||
this.$window.find('> .body').css('height', height-header_height);
|
||||
this.$window.find('> .body > .box').css('height', height-85);
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
setPlaceholder: function(placeholder) {
|
||||
this._placeholder = placeholder;
|
||||
},
|
||||
|
|
|
@ -1382,7 +1382,7 @@ define([
|
|||
Common.Gateway.internalMessage('processMouse', {event: 'mouse:up'});
|
||||
})
|
||||
.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()});
|
||||
}
|
||||
},this));
|
||||
|
@ -2529,6 +2529,9 @@ define([
|
|||
case 'window:drag':
|
||||
this.isDiagramDrag = data.data;
|
||||
break;
|
||||
case 'window:resize':
|
||||
this.isDiagramResize = data.data;
|
||||
break;
|
||||
case 'processmouse':
|
||||
this.onProcessMouse(data.data);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue