diff --git a/apps/presentationeditor/main/app/controller/Transitions.js b/apps/presentationeditor/main/app/controller/Transitions.js index 09a8a81a2..6b8efb3b0 100644 --- a/apps/presentationeditor/main/app/controller/Transitions.js +++ b/apps/presentationeditor/main/app/controller/Transitions.js @@ -121,20 +121,20 @@ define([ } }, - onParameterClick: function (item) { - this.EffectType = item.value; - if (this.api && !this._noApply) { + onParameterClick: function (value) { + this._state.EffectType = value; + if (this.api) { var props = new Asc.CAscSlideProps(); var transition = new Asc.CAscSlideTransition(); - transition.put_TransitionType(this.Effect); - transition.put_TransitionOption(this.EffectType); + transition.put_TransitionType(this._state.Effect); + transition.put_TransitionOption(this._state.EffectType); props.put_transition(transition); this.api.SetSlideProps(props); } }, onDurationChange: function(field, newValue, oldValue, eOpts) { - if (this.api && !this._noApply) { + if (this.api) { var props = new Asc.CAscSlideProps(); var transition = new Asc.CAscSlideTransition(); transition.put_TransitionDuration(field.getNumberValue()*1000); @@ -144,7 +144,7 @@ define([ }, onStartOnClickChange: function(field, newValue, oldValue, eOpts) { - if (this.api && !this._noApply) { + if (this.api) { var props = new Asc.CAscSlideProps(); var transition = new Asc.CAscSlideTransition(); transition.put_SlideAdvanceOnMouseClick(field.getValue() == 'checked'); @@ -154,7 +154,7 @@ define([ }, onDelayChange: function(field, newValue, oldValue, eOpts) { - if (this.api && !this._noApply) { + if (this.api) { var props = new Asc.CAscSlideProps(); var transition = new Asc.CAscSlideTransition(); transition.put_SlideAdvanceDuration(field.getNumberValue()*1000); @@ -165,7 +165,7 @@ define([ onCheckDelayChange: function(field, newValue, oldValue, eOpts) { this.view.numDelay.setDisabled(field.getValue() !== 'checked'); - if (this.api && !this._noApply) { + if (this.api) { var props = new Asc.CAscSlideProps(); var transition = new Asc.CAscSlideTransition(); transition.put_SlideAdvanceAfter(field.getValue() == 'checked'); @@ -180,24 +180,15 @@ define([ onEffectSelect: function (combo, record) { var type = record.get('value'); + var parameter = this._state.EffectType; - if (this.Effect !== type && - !((this.Effect === Asc.c_oAscSlideTransitionTypes.Wipe || this.Effect === Asc.c_oAscSlideTransitionTypes.UnCover || this.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); - if (parameter) - this.onParameterClick(parameter); - } - this.Effect = type; + 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))) + parameter = this.view.setMenuParameters(type); - if (this.api && !this._noApply) { - var props = new Asc.CAscSlideProps(); - var transition = new Asc.CAscSlideTransition(); - transition.put_TransitionType(type); - transition.put_TransitionOption(this.EffectType); - props.put_transition(transition); - this.api.SetSlideProps(props); - } + this._state.Effect = type; + this.onParameterClick(parameter); }, onFocusObject: function(selectedObjects) { @@ -273,7 +264,6 @@ define([ setSettings: function () { var me = this.view; - if (this._state.Effect !== undefined) { var item = me.listEffects.store.findWhere({value: this._state.Effect}); me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]); diff --git a/apps/presentationeditor/main/app/view/Transitions.js b/apps/presentationeditor/main/app/view/Transitions.js index 3751874af..07a57cc83 100644 --- a/apps/presentationeditor/main/app/view/Transitions.js +++ b/apps/presentationeditor/main/app/view/Transitions.js @@ -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]); }); } @@ -393,16 +390,16 @@ define([ } var selectedElement; - _.each(this.btnParameters.menu.items, function (element, index) { - if (((index < minMax[0])||(index > minMax[1]))) - element.$el.css('display', 'none'); - else { - element.$el.css('display', ''); + _.each(this.btnParameters.menu.items, function (element, index) { + 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) @@ -417,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; },