Resize ole editor

This commit is contained in:
Julia Radzhabova 2022-04-01 16:12:20 +03:00
parent 4341ea35c9
commit 0c040cec70
3 changed files with 24 additions and 9 deletions

View file

@ -98,12 +98,16 @@ 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<700 || innerHeight<h) {
h = Math.min(innerHeight, 700); h = Math.min(innerHeight, 700);
this.oleEditorView.setHeight(h); this.oleEditorView.setHeight(h);
this.oleEditorView.setInCenter();
} }
if (externalEditor) { if (externalEditor) {
@ -224,11 +228,13 @@ 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();
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});
this.oleEditorView.binding.resize && this.oleEditorView.binding.resize({pageX:x, pageY:y});
} }
} else } else
this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData); this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);

View file

@ -50,14 +50,17 @@ 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: 355,
minheight: 280,
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.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-85) + '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>',
@ -140,15 +143,18 @@ define([
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-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) { setPlaceholder: function(placeholder) {
this._placeholder = placeholder; this._placeholder = placeholder;
}, },

View file

@ -1382,7 +1382,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));
@ -2529,6 +2529,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;