[PE, SSE] Выставление опции сохранения пропорций для изображений, автофигур и диаграмм (см. баги 32442, 32436).

This commit is contained in:
Julia Radzhabova 2016-05-24 14:45:53 +03:00
parent af393af4ea
commit 76a3ee98d8
5 changed files with 50 additions and 27 deletions

View file

@ -71,7 +71,8 @@ define([
ChartStyle: 1,
ChartType: -1,
SeveralCharts: false,
DisabledControls: false
DisabledControls: false,
keepRatio: false
};
this._nRatio = 1;
this.spinners = [];
@ -213,15 +214,16 @@ define([
this.btnRatio.render($('#chart-button-ratio')) ;
this.lockedControls.push(this.btnRatio);
var value = Common.localStorage.getItem("pe-settings-chartratio");
if (value!==null && parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
this.btnRatio.on('click', _.bind(function(btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
Common.localStorage.setItem("pe-settings-chartratio", (btn.pressed) ? 1 : 0);
if (this.api) {
var props = new Asc.CAscChartProp();
props.asc_putLockAspect(btn.pressed);
this.api.ChartApply(props);
}
this.fireEvent('editcomplete', this);
}, this));
},
@ -312,6 +314,12 @@ define([
if (props.get_Height()>0)
this._nRatio = props.get_Width()/props.get_Height();
value = props.asc_getLockAspect();
if (this._state.keepRatio!==value) {
this.btnRatio.toggle(value);
this._state.keepRatio=value;
}
}
},

View file

@ -150,6 +150,9 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
if (this._changedProps) {
this._changedProps.asc_putLockAspect(btn.pressed);
}
}, this));
// Margins
@ -427,10 +430,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
if (props.get_Height()>0)
this._nRatio = props.get_Width()/props.get_Height();
var value = Common.localStorage.getItem("pe-settings-shaperatio");
if (value!==null && parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
var value = props.asc_getLockAspect();
this.btnRatio.toggle(value);
this._setShapeDefaults(props);

View file

@ -73,7 +73,8 @@ define([
ChartStyle: 1,
ChartType: -1,
SeveralCharts: false,
DisabledControls: false
DisabledControls: false,
keepRatio: false
};
this._nRatio = 1;
this.spinners = [];
@ -209,15 +210,15 @@ define([
this.btnRatio.render($('#chart-button-ratio')) ;
this.lockedControls.push(this.btnRatio);
var value = Common.localStorage.getItem("sse-settings-chartratio");
if (value!==null && parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
this.btnRatio.on('click', _.bind(function(btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
Common.localStorage.setItem("sse-settings-chartratio", (btn.pressed) ? 1 : 0);
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putLockAspect(btn.pressed);
this.api.asc_setGraphicObjectProps(props);
}
}, this));
$(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this));
@ -314,6 +315,12 @@ define([
if (props.asc_getHeight()>0)
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
value = props.asc_getLockAspect();
if (this._state.keepRatio!==value) {
this.btnRatio.toggle(value);
this._state.keepRatio=value;
}
}
},

View file

@ -71,7 +71,8 @@ define([
this._state = {
Width: 0,
Height: 0,
DisabledControls: false
DisabledControls: false,
keepRatio: false
};
this.spinners = [];
this.lockedControls = [];
@ -115,15 +116,15 @@ define([
this.btnRatio.render($('#image-button-ratio')) ;
this.lockedControls.push(this.btnRatio);
var value = Common.localStorage.getItem("sse-settings-imageratio");
if (value===null || parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
this.btnRatio.on('click', _.bind(function(btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
Common.localStorage.setItem("sse-settings-imageratio", (btn.pressed) ? 1 : 0);
if (this.api) {
var props = new Asc.asc_CImgProperty();
props.asc_putLockAspect(btn.pressed);
this.api.asc_setGraphicObjectProps(props);
}
}, this));
this.btnOriginalSize = new Common.UI.Button({
@ -204,6 +205,12 @@ define([
if (props.asc_getHeight()>0)
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
value = props.asc_getLockAspect();
if (this._state.keepRatio!==value) {
this.btnRatio.toggle(value);
this._state.keepRatio=value;
}
this.btnOriginalSize.setDisabled(props.asc_getImageUrl()===null || props.asc_getImageUrl()===undefined || this._locked);
}
},

View file

@ -150,6 +150,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
if (this._changedProps) {
this._changedProps.asc_putLockAspect(btn.pressed);
}
}, this));
// Margins
@ -453,10 +456,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
if (props.asc_getHeight()>0)
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
var value = Common.localStorage.getItem("sse-settings-shaperatio");
if (value!==null && parseInt(value) == 1) {
this.btnRatio.toggle(true);
}
var value = props.asc_getLockAspect();
this.btnRatio.toggle(value);
this._setShapeDefaults(shapeprops);
@ -478,7 +479,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp
},
getSettings: function() {
Common.localStorage.setItem("sse-settings-shaperatio", (this.btnRatio.pressed) ? 1 : 0);
return { shapeProps: this._changedProps} ;
},