Commit 76a3ee98 authored by Julia Radzhabova's avatar Julia Radzhabova

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

[PE, SSE] Выставление опции сохранения пропорций для изображений, автофигур и диаграмм (см. баги 32442, 32436).
parent af393af4
......@@ -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;
}
}
},
......
......@@ -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);
......
......@@ -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;
}
}
},
......
......@@ -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);
}
},
......
......@@ -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} ;
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment