From 20dff7b2fb39b89fe62f1f1e9a5c703e47bfa7f2 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Mon, 20 Dec 2021 19:07:49 +0300 Subject: [PATCH] Fix bugs --- apps/common/main/lib/util/define.js | 4 +-- .../main/app/controller/Animation.js | 26 +++++++++---------- .../main/app/view/Animation.js | 4 +-- .../main/app/view/AnimationDialog.js | 6 ++--- apps/presentationeditor/main/locale/en.json | 1 + 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/apps/common/main/lib/util/define.js b/apps/common/main/lib/util/define.js index 2c1ad94171..322ce1763e 100644 --- a/apps/common/main/lib/util/define.js +++ b/apps/common/main/lib/util/define.js @@ -870,8 +870,8 @@ define(function(){ 'use strict'; {group: 'menu-effect-group-path', value: AscFormat.MOTION_TRAPEZOID, iconCls: 'animation-motion_paths-shapes', displayValue: this.textTrapezoid}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'animation-motion_paths-loops', displayValue: this.textHorizontalFigure}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_VERTICAL_FIGURE_8, iconCls: 'animation-motion_paths-loops', displayValue: this.textVerticalFigure}, - {group: 'menu-effect-group-path', value: AscFormat.MOTION_LOOP_DE_LOOP, iconCls: 'animation-motion_paths-loops', displayValue: this.textLoopDeLoop}, - {group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'animation-motion_paths-custom_path', displayValue: this.textCustomPath} + {group: 'menu-effect-group-path', value: AscFormat.MOTION_LOOP_DE_LOOP, iconCls: 'animation-motion_paths-loops', displayValue: this.textLoopDeLoop}//, + //{group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'animation-motion_paths-custom_path', displayValue: this.textCustomPath} ]; }, diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index 4069316cbb..9744345abf 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -156,12 +156,13 @@ define([ onAnimationAdditional: function(replace) { // replace or add new additional effect var me = this; (new PE.Views.AnimationDialog({ - api : this.api, - activeEffect : this._state.Effect, - handler: function(result, value) { + api : this.api, + activeEffect : this._state.Effect, + groupValue : this._state.EffectGroup, + handler : function(result, value) { if (result == 'ok') { if (me.api) { - me.addNewEffect(value.activeEffect, value.activeGroupValue, replace); + me.addNewEffect(value.activeEffect, value.activeGroupValue, value.activeGroup, replace); } } } @@ -170,13 +171,13 @@ define([ onAddAnimation: function(picker, record) { var type = record.get('value'); - var group = _.findWhere(Common.define.effectData.getEffectGroupData(), {id: record.get('group')}).value; - this.addNewEffect(type, group, false); + var group = _.findWhere(this.EffectGroups, {id: record.get('group')}).value; + this.addNewEffect(type, group, record.get('group'), false); }, - addNewEffect: function (type, group, replace) { + addNewEffect: function (type, group, groupName, replace) { if (this._state.Effect == type) return; - var parameter = this.view.setMenuParameters(type, undefined, group == this._state.EffectGroups); + var parameter = this.view.setMenuParameters(type, groupName, undefined); this.api.asc_AddAnimation(group, type, (parameter != undefined)?parameter:0, replace); this._state.EffectGroups = group; this._state.Effect = type; @@ -236,14 +237,13 @@ define([ onEffectSelect: function (combo, record) { if (this.api) { var type = record.get('value'); - var group = (type != AscFormat.ANIM_PRESET_NONE) ? _.findWhere(Common.define.effectData.getEffectGroupData(), {id: record.get('group')}).value : undefined; - this.addNewEffect(type, group, this._state.Effect != AscFormat.ANIM_PRESET_NONE); + var group = (type != AscFormat.ANIM_PRESET_NONE) ? _.findWhere(this.EffectGroups, {id: record.get('group')}).value : undefined; + this.addNewEffect(type, group, record.get('group'),this._state.Effect != AscFormat.ANIM_PRESET_NONE); } }, onStartSelect: function (combo, record) { if (this.api) { - // this._state.StartEffect = record.value; this.AnimationProperties.asc_putStartType(record.value); this.api.asc_SetAnimationProperties(this.AnimationProperties); } @@ -341,8 +341,8 @@ define([ } this._state.EffectOption = this.AnimationProperties.asc_getSubtype(); - if (this._state.EffectOption !== undefined) - this._state.noAnimationParam = view.setMenuParameters(this._state.Effect, this._state.EffectOption)===undefined; + 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; value = this.AnimationProperties.asc_getDuration(); if (Math.abs(this._state.Duration - value) > 0.001 || diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index e29ae88eeb..c664815233 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -477,9 +477,9 @@ define([ return this.lockedControls; }, - setMenuParameters: function (effectId, option) + setMenuParameters: function (effectId, effectGroup, option) { - var effect = _.findWhere(this.allEffects, {value: effectId}); + var effect = _.findWhere(this.allEffects, {group: effectGroup, value: effectId}); var arrEffectOptions = Common.define.effectData.getEffectOptionsData(effect.group, effect.value); if(!arrEffectOptions) { this.btnParameters.menu.removeAll(); diff --git a/apps/presentationeditor/main/app/view/AnimationDialog.js b/apps/presentationeditor/main/app/view/AnimationDialog.js index 9c0f722152..9684d9b1f9 100644 --- a/apps/presentationeditor/main/app/view/AnimationDialog.js +++ b/apps/presentationeditor/main/app/view/AnimationDialog.js @@ -72,9 +72,9 @@ define([ this.EffectGroupData.forEach(function (item) {item.displayValue = item.caption;}); if ((this.options.activeEffect != undefined) && (this.options.activeEffect != AscFormat.ANIM_PRESET_NONE)){ this._state.activeEffect = this.options.activeEffect; - var itemEffect = _.findWhere(this.allEffects,{value: this._state.activeEffect}); - this._state.activeGroup = itemEffect.group; - this._state.activeGroupValue = _.findWhere(this.EffectGroupData, {id: this._state.activeGroup}).value; + this._state.activeGroupValue = this.options.groupValue; + this._state.activeGroup = _.findWhere(this.EffectGroupData, {value: this._state.activeGroupValue}).id; + var itemEffect = _.findWhere(this.allEffects,{group: this._state.activeGroup, value: this._state.activeEffect}); this.activeLevel = itemEffect.level; } Common.UI.Window.prototype.initialize.call(this, this.options); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 30035918f6..e262054ce5 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -2101,6 +2101,7 @@ "PE.Views.Toolbar.textAlignMiddle": "Align text to the middle", "PE.Views.Toolbar.textAlignRight": "Align text right", "PE.Views.Toolbar.textAlignTop": "Align text to the top", + "PE.Views.Toolbar.textTabAnimation": "Animation", "PE.Views.Toolbar.textArrangeBack": "Send to Background", "PE.Views.Toolbar.textArrangeBackward": "Send Backward", "PE.Views.Toolbar.textArrangeForward": "Bring Forward",