[PE] Animation: support several effects with different subtypes

This commit is contained in:
Julia Radzhabova 2022-01-20 13:22:41 +03:00
parent 39b929a779
commit fed5f742e3
3 changed files with 9 additions and 7 deletions

View file

@ -1142,7 +1142,7 @@ define(function(){ 'use strict';
{value: AscFormat.ENTRANCE_WIPE_FROM_BOTTOM, caption: this.textFromBottom}, {value: AscFormat.ENTRANCE_WIPE_FROM_BOTTOM, caption: this.textFromBottom},
{value: AscFormat.ENTRANCE_WIPE_FROM_LEFT, caption: this.textFromLeft}, {value: AscFormat.ENTRANCE_WIPE_FROM_LEFT, caption: this.textFromLeft},
{value: AscFormat.ENTRANCE_WIPE_FROM_RIGHT, caption: this.textFromRight}, {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: case AscFormat.ENTRANCE_ZOOM:
return [ return [

View file

@ -425,8 +425,10 @@ define([
} }
this._state.EffectOption = this.AnimationProperties.asc_getSubtype(); this._state.EffectOption = this.AnimationProperties.asc_getSubtype();
if (this._state.EffectOption !== undefined && this._state.EffectOption !== null) if (this._state.EffectOption !== null && this._state.Effect !== AscFormat.ANIM_PRESET_MULTIPLE && this._state.Effect !== AscFormat.ANIM_PRESET_NONE) {
this._state.noAnimationParam = view.setMenuParameters(this._state.Effect, _.findWhere(this.EffectGroups,{value: this._state.EffectGroup}).id, this._state.EffectOption)===undefined; 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(); value = this.AnimationProperties.asc_getDuration();
this._state.Duration = (value>=0) ? value/1000 : value ; // undefined or <0 this._state.Duration = (value>=0) ? value/1000 : value ; // undefined or <0

View file

@ -515,7 +515,7 @@ define([
return this.lockedControls; 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 arrEffectOptions;
var effect = _.findWhere(this.allEffects, {group: effectGroup, value: effectId}); var effect = _.findWhere(this.allEffects, {group: effectGroup, value: effectId});
@ -537,14 +537,14 @@ define([
}, this); }, this);
} }
else { else {
this.btnParameters.menu.clearAll();
this.btnParameters.menu.items.forEach(function (opt) { this.btnParameters.menu.items.forEach(function (opt) {
(opt.value == option) && (selectedElement = opt); (opt.value == option) && (selectedElement = opt);
}); });
} }
(selectedElement == undefined) && (selectedElement = this.btnParameters.menu.items[0]) selectedElement && selectedElement.setChecked(true);
selectedElement.setChecked(true);
this._effectId = effectId; this._effectId = effectId;
return selectedElement.value; return selectedElement ? selectedElement.value : this.btnParameters.menu.items[0].value;
}, },