Set initial size for ole object
This commit is contained in:
parent
0c040cec70
commit
d3719967dd
|
@ -104,10 +104,8 @@ define([
|
|||
'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);
|
||||
this.oleEditorView.setInCenter();
|
||||
}
|
||||
|
||||
if (externalEditor) {
|
||||
|
@ -228,14 +226,20 @@ define([
|
|||
if (eventData.type == "processMouse") {
|
||||
if (eventData.data.event == 'mouse:up') {
|
||||
this.oleEditorView.binding.dragStop();
|
||||
this.oleEditorView.binding.resizeStop();
|
||||
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});
|
||||
this.oleEditorView.binding.resize && this.oleEditorView.binding.resize({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);
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ define([
|
|||
|
||||
render: function() {
|
||||
Common.UI.Window.prototype.render.call(this);
|
||||
this._headerFooterHeight = 85 + ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))));
|
||||
this.boxEl = this.$window.find('.body > .box');
|
||||
|
||||
this.btnSave = new Common.UI.Button({
|
||||
el: $('#id-btn-ole-editor-apply'),
|
||||
|
@ -155,6 +157,26 @@ define([
|
|||
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'))),
|
||||
bordersOffset = this.bordersOffset*2;
|
||||
height += 90; // add toolbar and statusbar height
|
||||
if (maxHeight - bordersOffset<height + this._headerFooterHeight)
|
||||
height = maxHeight - bordersOffset - this._headerFooterHeight;
|
||||
if (maxWidth - bordersOffset<width + borders_width)
|
||||
width = maxWidth - bordersOffset - borders_width;
|
||||
|
||||
this.boxEl.css('height', height);
|
||||
|
||||
this.setHeight(height + this._headerFooterHeight);
|
||||
this.setWidth(width + borders_width);
|
||||
|
||||
// this.$window.css('left',(maxWidth - width - borders_width) / 2);
|
||||
// this.$window.css('top',(maxHeight - height - this._headerFooterHeight) / 2);
|
||||
},
|
||||
|
||||
setPlaceholder: function(placeholder) {
|
||||
this._placeholder = placeholder;
|
||||
},
|
||||
|
|
|
@ -2568,8 +2568,13 @@ define([
|
|||
},
|
||||
|
||||
setOleData: function(obj) {
|
||||
var callback = function(value) {
|
||||
Common.Gateway.internalMessage('resize', {
|
||||
width: value.width, height: value.height
|
||||
});
|
||||
};
|
||||
if (typeof obj === 'object' && this.api) {
|
||||
this.api.asc_addTableOleObjectInOleEditor(obj);
|
||||
this.api.asc_addTableOleObjectInOleEditor(obj, callback);
|
||||
this.isFrameClosed = false;
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue