Refactoring

This commit is contained in:
OVSharova 2021-10-22 17:32:38 +03:00
parent 1a7d36f4d2
commit 3e582f9c31
2 changed files with 14 additions and 15 deletions

View file

@ -121,8 +121,8 @@ define([
}
},
onParameterClick: function (item) {
this._state.EffectType = item.value;
onParameterClick: function (value) {
this._state.EffectType = value;
if (this.api) {
var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition();
@ -183,13 +183,14 @@ define([
if (this._state.Effect !== type &&
!((this._state.Effect === Asc.c_oAscSlideTransitionTypes.Wipe || this._state.Effect === Asc.c_oAscSlideTransitionTypes.UnCover || this._state.Effect === Asc.c_oAscSlideTransitionTypes.Cover)&&
(type === Asc.c_oAscSlideTransitionTypes.Wipe || type === Asc.c_oAscSlideTransitionTypes.UnCover || type === Asc.c_oAscSlideTransitionTypes.Cover))) {
var parameter = this.view.setMenuParameters(type);
this._state.Effect = type;
if (parameter)
this.onParameterClick(parameter);
}
(type === Asc.c_oAscSlideTransitionTypes.Wipe || type === Asc.c_oAscSlideTransitionTypes.UnCover || type === Asc.c_oAscSlideTransitionTypes.Cover)))
var parameter = this.view.setMenuParameters(type);
this._state.Effect = type;
if (parameter)
this.onParameterClick(parameter);
else
this.onParameterClick(this._state.EffectType);
},
onFocusObject: function(selectedObjects) {

View file

@ -70,12 +70,9 @@ define([
}
if (me.btnParameters) {
me.btnParameters.on('click', function (e) {
me.fireEvent('transit:parameters', ['current']);
});
me.btnParameters.menu.on('item:click', function (menu, item, e) {
me.fireEvent('transit:parameters', [item]);
me.fireEvent('transit:parameters', [item.value]);
});
}
@ -395,13 +392,14 @@ define([
var selectedElement;
_.each(this.btnParameters.menu.items, function (element, index) {
element.setVisible(((index >= minMax[0])&&(index <= minMax[1])));
if ((index >= minMax[0])&&(index <= minMax[1])) {
element.setVisible(true);
if (value != undefined) {
if (value == element.value) selectedElement = element;
}
}
else
element.setVisible(false);
});
if (selectedElement == undefined)
@ -416,7 +414,7 @@ define([
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
}
return selectedElement;
return (selectedElement)?selectedElement.value:-1;
},