[SSE] Scale Settings

This commit is contained in:
Julia Svinareva 2019-09-18 13:13:22 +03:00
parent b99ac80d7a
commit 92522e9f09

View file

@ -129,15 +129,9 @@ define([
editable: true, editable: true,
data: this.arrDataScale, data: this.arrDataScale,
scrollAlwaysVisible: true scrollAlwaysVisible: true
}).on('selected', _.bind(function (field) { }).on('selected', _.bind(this.changeWidthHeight, this, 'width'))
this._state.width = field.getValue(); .on('changed:after', _.bind(this.changeWidthHeight, this, 'width'))
if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) { .on('changed:before', _.bind(this.onChangeComboScale, this, 'width'));
this.radioScaleTo.setValue(true, true);
} else {
this.radioFitTo.setValue(true, true);
}
}, this))
.on('changed:before', _.bind(this.onChangeComboScale, this, 'width'));
this.cmbScaleHeight = new Common.UI.ComboBox({ this.cmbScaleHeight = new Common.UI.ComboBox({
el: $('#scale-height'), el: $('#scale-height'),
@ -147,15 +141,9 @@ define([
editable: true, editable: true,
data: this.arrDataScale, data: this.arrDataScale,
scrollAlwaysVisible: true scrollAlwaysVisible: true
}).on('selected', _.bind(function (field) { }).on('selected', _.bind(this.changeWidthHeight, this, 'height'))
this._state.height = field.getValue(); .on('changed:after', _.bind(this.changeWidthHeight, this, 'height'))
if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) { .on('changed:before', _.bind(this.onChangeComboScale, this, 'height'));
this.radioScaleTo.setValue(true, true);
} else {
this.radioFitTo.setValue(true, true);
}
}, this))
.on('changed:before', _.bind(this.onChangeComboScale, this, 'height'));
this.spnScale = new Common.UI.MetricSpinner({ this.spnScale = new Common.UI.MetricSpinner({
el : $('#scale'), el : $('#scale'),
@ -199,6 +187,26 @@ define([
return false; return false;
}, },
changeWidthHeight: function (type, field) {
var value = field.getValue();
if (typeof(value) === 'string') {
value = parseInt(value);
if (isNaN(value)) {
value = 0;
}
}
if (type === 'width') {
this._state.width = value;
} else {
this._state.height = value;
}
if ((this._state.width === 0 || this._state.width === null) && (this._state.height === 0 || this._state.height === null)) {
this.radioScaleTo.setValue(true, true);
} else {
this.radioFitTo.setValue(true, true);
}
},
onRadioScale: function(type, field, newValue) { onRadioScale: function(type, field, newValue) {
if (type === 'scaleto') { if (type === 'scaleto') {
this.cmbScaleHeight.setValue(0,true); this.cmbScaleHeight.setValue(0,true);