[SSE] Scale Dialog (set disabled)

This commit is contained in:
Julia Svinareva 2019-08-26 16:38:08 +03:00
parent 580b80a232
commit 5a51a8d85f

View file

@ -56,6 +56,11 @@ define([
title: this.textTitle
}, options || {});
this._state = {
width: 'Auto',
height: 'Auto'
};
this.template = [
'<div class="box">',
'<table style="width: 100%;"><tbody>',
@ -99,6 +104,10 @@ define([
minValue : 1,
allowAuto : true
});
this.spnScaleWidth.on('change', _.bind(function (field) {
this._state.width = field.getValue();
this.setDisabledScale();
}, this));
this.spnScaleHeight = new Common.UI.MetricSpinner({
el : $('#scale-height'),
@ -110,6 +119,10 @@ define([
minValue : 1,
allowAuto : true
});
this.spnScaleHeight.on('change', _.bind(function (field) {
this._state.height = field.getValue();
this.setDisabledScale();
}, this));
this.spnScale = new Common.UI.MetricSpinner({
el : $('#scale'),
@ -138,6 +151,15 @@ define([
this._handleInput(event.currentTarget.attributes['result'].value);
},
setDisabledScale: function() {
if (this._state.height !== 'Auto' || this._state.width !== 'Auto') {
this.spnScale.setValue('100 %');
this.spnScale.setDisabled(true);
} else {
this.spnScale.setDisabled(false);
}
},
textTitle: 'Scale Settings',
cancelButtonText: 'Cancel',
okButtonText: 'Ok',