From fed5f742e3f0c72eeb16a30b7874992cf17f8c5b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 20 Jan 2022 13:22:41 +0300 Subject: [PATCH] [PE] Animation: support several effects with different subtypes --- apps/common/main/lib/util/define.js | 2 +- apps/presentationeditor/main/app/controller/Animation.js | 6 ++++-- apps/presentationeditor/main/app/view/Animation.js | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/common/main/lib/util/define.js b/apps/common/main/lib/util/define.js index 3e98d66a2..83bacabc6 100644 --- a/apps/common/main/lib/util/define.js +++ b/apps/common/main/lib/util/define.js @@ -1142,7 +1142,7 @@ define(function(){ 'use strict'; {value: AscFormat.ENTRANCE_WIPE_FROM_BOTTOM, caption: this.textFromBottom}, {value: AscFormat.ENTRANCE_WIPE_FROM_LEFT, caption: this.textFromLeft}, {value: AscFormat.ENTRANCE_WIPE_FROM_RIGHT, caption: this.textFromRight}, - {value: AscFormat.ENTRANCE_WIPE_FROM_FROM_TOP, caption: this.textFromTop} + {value: AscFormat.ENTRANCE_WIPE_FROM_TOP, caption: this.textFromTop} ]; case AscFormat.ENTRANCE_ZOOM: return [ diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index 4cc2d6a55..22b7b4ac8 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -425,8 +425,10 @@ define([ } this._state.EffectOption = this.AnimationProperties.asc_getSubtype(); - if (this._state.EffectOption !== undefined && this._state.EffectOption !== null) - this._state.noAnimationParam = view.setMenuParameters(this._state.Effect, _.findWhere(this.EffectGroups,{value: this._state.EffectGroup}).id, this._state.EffectOption)===undefined; + if (this._state.EffectOption !== null && this._state.Effect !== AscFormat.ANIM_PRESET_MULTIPLE && this._state.Effect !== AscFormat.ANIM_PRESET_NONE) { + var rec = _.findWhere(this.EffectGroups,{value: this._state.EffectGroup}); + this._state.noAnimationParam = view.setMenuParameters(this._state.Effect, rec ? rec.id : undefined, this._state.EffectOption)===undefined; + } value = this.AnimationProperties.asc_getDuration(); this._state.Duration = (value>=0) ? value/1000 : value ; // undefined or <0 diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 7cb5d5189..a510e159b 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -515,7 +515,7 @@ define([ return this.lockedControls; }, - setMenuParameters: function (effectId, effectGroup, option) + setMenuParameters: function (effectId, effectGroup, option) // option = undefined - for add new effect or when selected 2 equal effects with different option (subtype) { var arrEffectOptions; var effect = _.findWhere(this.allEffects, {group: effectGroup, value: effectId}); @@ -537,14 +537,14 @@ define([ }, this); } else { + this.btnParameters.menu.clearAll(); this.btnParameters.menu.items.forEach(function (opt) { (opt.value == option) && (selectedElement = opt); }); } - (selectedElement == undefined) && (selectedElement = this.btnParameters.menu.items[0]) - selectedElement.setChecked(true); + selectedElement && selectedElement.setChecked(true); this._effectId = effectId; - return selectedElement.value; + return selectedElement ? selectedElement.value : this.btnParameters.menu.items[0].value; },