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){
 | 
			
		||||
                            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);
 | 
			
		||||
                            if (innerHeight<h) {
 | 
			
		||||
                                this.oleEditorView.setHeight(h);
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -224,12 +226,20 @@ define([
 | 
			
		|||
                    if (eventData.type == "processMouse") {
 | 
			
		||||
                        if (eventData.data.event == 'mouse:up') {
 | 
			
		||||
                            this.oleEditorView.binding.dragStop();
 | 
			
		||||
                            if (this.oleEditorView.binding.resizeStop)  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});
 | 
			
		||||
                            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
 | 
			
		||||
                        this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,14 +50,19 @@ define([
 | 
			
		|||
                title: this.textTitle,
 | 
			
		||||
                width: 910,
 | 
			
		||||
                height: (_inner_height - 700)<0 ? _inner_height : 700,
 | 
			
		||||
                minwidth: 880,
 | 
			
		||||
                minheight: 275,
 | 
			
		||||
                cls: 'advanced-settings-dlg',
 | 
			
		||||
                header: true,
 | 
			
		||||
                toolclose: 'hide',
 | 
			
		||||
                toolcallback: _.bind(this.onToolClose, this)
 | 
			
		||||
                toolcallback: _.bind(this.onToolClose, this),
 | 
			
		||||
                resizable: true
 | 
			
		||||
            }, options);
 | 
			
		||||
 | 
			
		||||
            this._headerFooterHeight = 85;
 | 
			
		||||
 | 
			
		||||
            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>',
 | 
			
		||||
                '<div class="separator horizontal"></div>',
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +82,7 @@ define([
 | 
			
		|||
 | 
			
		||||
        render: function() {
 | 
			
		||||
            Common.UI.Window.prototype.render.call(this);
 | 
			
		||||
            this.boxEl = this.$window.find('.body > .box');
 | 
			
		||||
 | 
			
		||||
            this.btnSave = new Common.UI.Button({
 | 
			
		||||
                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;
 | 
			
		||||
 | 
			
		||||
                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);
 | 
			
		||||
                this.$window.find('> .body > .box').css('height', height-this._headerFooterHeight);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        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) {
 | 
			
		||||
            this._placeholder = placeholder;
 | 
			
		||||
        },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1415,7 +1415,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));
 | 
			
		||||
| 
						 | 
				
			
			@ -2572,6 +2572,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