From 8f88e5b12d7b5abdccb0dbf1c4f9e0f7d6e32958 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 11 Aug 2022 18:54:02 +0300 Subject: [PATCH 1/3] [PE] Add custom path animation --- apps/common/main/lib/util/define.js | 7 ++++--- apps/presentationeditor/main/app/controller/Animation.js | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/util/define.js b/apps/common/main/lib/util/define.js index b0dae8936..bb826a37f 100644 --- a/apps/common/main/lib/util/define.js +++ b/apps/common/main/lib/util/define.js @@ -849,8 +849,8 @@ define(function(){ 'use strict'; {group: 'menu-effect-group-path', value: AscFormat.MOTION_ARC_DOWN, iconCls: 'animation-motion-paths-arcs', displayValue: this.textArcs, familyEffect: 'patharcs'}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_TURN_DOWN, iconCls: 'animation-motion-paths-turns', displayValue: this.textTurns, familyEffect: 'pathturns'}, {group: 'menu-effect-group-path', value: AscFormat.MOTION_CIRCLE, iconCls: 'animation-motion-paths-shapes', displayValue: this.textShapes, familyEffect: 'pathshapes'}, - {group: 'menu-effect-group-path', value: AscFormat.MOTION_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'animation-motion-paths-loops', displayValue: this.textLoops, familyEffect: 'pathloops'}//, - //{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_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'animation-motion-paths-loops', displayValue: this.textLoops, familyEffect: 'pathloops'}, + {group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'animation-motion-paths-custom-path', displayValue: this.textCustomPath} ]; }, @@ -1038,7 +1038,8 @@ define(function(){ 'use strict'; {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_PEANUT, displayValue: this.textPeanut}, {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_POINTY_STAR, displayValue: this.textPointStar}, {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_SWOOSH, displayValue: this.textSwoosh}, - {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_VERTICAL_FIGURE_8, displayValue: this.textVerticalFigure, familyEffect: 'pathloops'} + {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_VERTICAL_FIGURE_8, displayValue: this.textVerticalFigure, familyEffect: 'pathloops'}, + {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_CUSTOM_PATH, displayValue: this.textCustomPath, notsupported: true} ]; }, diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index eda06eca8..eaa4576bf 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -326,7 +326,9 @@ define([ var group = _.findWhere(this.EffectGroups, {id: record.get('group')}); group = group ? group.value : undefined; - this.addNewEffect(type, group, record.get('group'),this._state.Effect != AscFormat.ANIM_PRESET_NONE); + var prevEffect = this._state.Effect; + this._state.Effect = undefined; + this.addNewEffect(type, group, record.get('group'),prevEffect != AscFormat.ANIM_PRESET_NONE); } }, From cb4010908992eefc035b4af519c9e2da1d208e50 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 17 Aug 2022 01:35:12 +0300 Subject: [PATCH 2/3] [PE] Add options for custom path --- apps/common/main/lib/util/define.js | 17 ++++++++++-- .../main/app/controller/Animation.js | 4 +++ .../main/app/view/Animation.js | 27 ++++++++++++------- apps/presentationeditor/main/locale/en.json | 3 +++ 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/util/define.js b/apps/common/main/lib/util/define.js index bb826a37f..57fc090ce 100644 --- a/apps/common/main/lib/util/define.js +++ b/apps/common/main/lib/util/define.js @@ -794,6 +794,9 @@ define(function(){ 'use strict'; textTurns: 'Turns', textShapes: 'Shapes', textLoops: 'Loops', + textPathCurve: 'Curve', + textPathLine: 'Line', + textPathScribble: 'Scribble', getEffectGroupData: function () { return [ @@ -1039,7 +1042,7 @@ define(function(){ 'use strict'; {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_POINTY_STAR, displayValue: this.textPointStar}, {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_SWOOSH, displayValue: this.textSwoosh}, {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_VERTICAL_FIGURE_8, displayValue: this.textVerticalFigure, familyEffect: 'pathloops'}, - {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_CUSTOM_PATH, displayValue: this.textCustomPath, notsupported: true} + {group: 'menu-effect-group-path', level: 'menu-effect-level-special', value: AscFormat.MOTION_CUSTOM_PATH, displayValue: this.textCustomPath, notsupported: true} ]; }, @@ -1278,11 +1281,21 @@ define(function(){ 'use strict'; return undefined; } break; + case 'menu-effect-group-path': + switch (type) { + case AscFormat.MOTION_CUSTOM_PATH: + return [ + {value: AscFormat.MOTION_CUSTOM_PATH_CURVE, caption: this.textPathCurve, isCustom: true}, + {value: AscFormat.MOTION_CUSTOM_PATH_LINE, caption: this.textPathLine, isCustom: true}, + {value: AscFormat.MOTION_CUSTOM_PATH_SCRIBBLE, caption: this.textPathScribble, isCustom: true} + ]; + } + break; default: return undefined; } }, - getSimilarEffectsArray: function (group, familyEffect) { + getSimilarEffectsArray: function (familyEffect) { switch (familyEffect){ case 'shape': return [ diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index eaa4576bf..bd7b35127 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -155,6 +155,10 @@ define([ this.AnimationProperties.asc_putSubtype(value); this.api.asc_SetAnimationProperties(this.AnimationProperties); } + else if(toggleGroup=='custompath') { + var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id; + this.addNewEffect(AscFormat.MOTION_CUSTOM_PATH, this._state.EffectGroup, groupName,true, value); + } else { var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id; this.addNewEffect(value, this._state.EffectGroup, groupName,true, this._state.EffectOption); diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index b17125654..b971b32c6 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -96,7 +96,7 @@ define([ if (me.btnParameters) { me.btnParameters.menu.on('item:click', function (menu, item, e) { - me.fireEvent('animation:parameters', [item.value, item.toggleGroup]); + me.fireEvent('animation:parameters', [item.value, item.options.isCustom ? 'custompath' : item.toggleGroup]); }); } @@ -572,25 +572,32 @@ define([ } if (arrEffectOptions){ if (this.btnParameters.menu.items.length == 0) { - arrEffectOptions.forEach(function (opt, index) { - opt.checkable = true; - opt.toggleGroup = 'animateeffects'; - this.btnParameters.menu.addItem(opt); - (opt.value == option || option===undefined && !!opt.defvalue) && (selectedElement = this.btnParameters.menu.items[index]); - }, this); + if (effectGroup==='menu-effect-group-path' && effectId===AscFormat.MOTION_CUSTOM_PATH) { + arrEffectOptions.forEach(function (opt, index) { + this.btnParameters.menu.addItem(opt); + (opt.value == option || option===undefined && !!opt.defvalue) && (selectedElement = this.btnParameters.menu.items[index]); + }, this); + } else { + arrEffectOptions.forEach(function (opt, index) { + opt.checkable = true; + opt.toggleGroup = 'animateeffects'; + this.btnParameters.menu.addItem(opt); + (opt.value == option || option===undefined && !!opt.defvalue) && (selectedElement = this.btnParameters.menu.items[index]); + }, this); + } (effect && effect.familyEffect) && this.btnParameters.menu.addItem({caption: '--'}); } else { this.btnParameters.menu.clearAll(); this.btnParameters.menu.items.forEach(function (opt) { - if(opt.toggleGroup == 'animateeffects' && (opt.value == option || option===undefined && !!opt.options.defvalue)) + if((opt.toggleGroup == 'animateeffects' || effectGroup==='menu-effect-group-path' && effectId===AscFormat.MOTION_CUSTOM_PATH) && (opt.value == option || option===undefined && !!opt.options.defvalue)) selectedElement = opt; },this); } - selectedElement && selectedElement.setChecked(true); + !(effectGroup==='menu-effect-group-path' && effectId===AscFormat.MOTION_CUSTOM_PATH) && selectedElement && selectedElement.setChecked(true); } if (effect && effect.familyEffect){ if (this._familyEffect != effect.familyEffect) { - var effectsArray = Common.define.effectData.getSimilarEffectsArray(effectGroup, effect.familyEffect); + var effectsArray = Common.define.effectData.getSimilarEffectsArray(effect.familyEffect); effectsArray.forEach(function (opt) { opt.checkable = true; opt.toggleGroup = 'animatesimilareffects' diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index a2534b18b..1fbe25448 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -245,6 +245,9 @@ "Common.define.effectData.textWipe": "Wipe", "Common.define.effectData.textZigzag": "Zigzag", "Common.define.effectData.textZoom": "Zoom", + "Common.define.effectData.textPathCurve": "Curve", + "Common.define.effectData.textPathLine": "Line", + "Common.define.effectData.textPathScribble": "Scribble", "Common.Translation.textMoreButton": "More", "Common.Translation.warnFileLocked": "The file is being edited in another app. You can continue editing and save it as a copy.", "Common.Translation.warnFileLockedBtnEdit": "Create a copy", From 5245b4247d4c21c5eafafbb26b9046bf3a6818a4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 24 Aug 2022 01:50:17 +0300 Subject: [PATCH 3/3] [PE] Enable parameters when set custom path animation --- .../main/app/controller/Animation.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index bd7b35127..7ae68b0ee 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -156,8 +156,8 @@ define([ this.api.asc_SetAnimationProperties(this.AnimationProperties); } else if(toggleGroup=='custompath') { - var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id; - this.addNewEffect(AscFormat.MOTION_CUSTOM_PATH, this._state.EffectGroup, groupName,true, value); + var groupName = _.findWhere(this.EffectGroups, {value: AscFormat.PRESET_CLASS_PATH}).id; + this.addNewEffect(AscFormat.MOTION_CUSTOM_PATH, AscFormat.PRESET_CLASS_PATH, groupName,true, value); } else { var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id; @@ -189,6 +189,10 @@ define([ var type = record.get('value'); var group = _.findWhere(this.EffectGroups, {id: record.get('group')}).value; this.addNewEffect(type, group, record.get('group'), false); + if (group===AscFormat.PRESET_CLASS_PATH && type===AscFormat.MOTION_CUSTOM_PATH) { + Common.Utils.lockControls(Common.enumLock.noAnimation, false, {array: [this.view.btnParameters]}); + Common.Utils.lockControls(Common.enumLock.noAnimationParam, false, {array: [this.view.btnParameters]}); + } }, addNewEffect: function (type, group, groupName, replace, parametr, preview) { @@ -333,6 +337,10 @@ define([ var prevEffect = this._state.Effect; this._state.Effect = undefined; this.addNewEffect(type, group, record.get('group'),prevEffect != AscFormat.ANIM_PRESET_NONE); + if (group===AscFormat.PRESET_CLASS_PATH && type===AscFormat.MOTION_CUSTOM_PATH) { + Common.Utils.lockControls(Common.enumLock.noAnimation, false, {array: [this.view.btnParameters]}); + Common.Utils.lockControls(Common.enumLock.noAnimationParam, false, {array: [this.view.btnParameters]}); + } } },