[PE] Add options for custom path

This commit is contained in:
Julia Radzhabova 2022-08-17 01:35:12 +03:00
parent 8f88e5b12d
commit cb40109089
4 changed files with 39 additions and 12 deletions

View file

@ -794,6 +794,9 @@ define(function(){ 'use strict';
textTurns: 'Turns', textTurns: 'Turns',
textShapes: 'Shapes', textShapes: 'Shapes',
textLoops: 'Loops', textLoops: 'Loops',
textPathCurve: 'Curve',
textPathLine: 'Line',
textPathScribble: 'Scribble',
getEffectGroupData: function () { getEffectGroupData: function () {
return [ return [
@ -1278,11 +1281,21 @@ define(function(){ 'use strict';
return undefined; return undefined;
} }
break; 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: default:
return undefined; return undefined;
} }
}, },
getSimilarEffectsArray: function (group, familyEffect) { getSimilarEffectsArray: function (familyEffect) {
switch (familyEffect){ switch (familyEffect){
case 'shape': case 'shape':
return [ return [

View file

@ -155,6 +155,10 @@ define([
this.AnimationProperties.asc_putSubtype(value); this.AnimationProperties.asc_putSubtype(value);
this.api.asc_SetAnimationProperties(this.AnimationProperties); 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 { else {
var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id; var groupName = _.findWhere(this.EffectGroups, {value: this._state.EffectGroup}).id;
this.addNewEffect(value, this._state.EffectGroup, groupName,true, this._state.EffectOption); this.addNewEffect(value, this._state.EffectGroup, groupName,true, this._state.EffectOption);

View file

@ -96,7 +96,7 @@ define([
if (me.btnParameters) { if (me.btnParameters) {
me.btnParameters.menu.on('item:click', function (menu, item, e) { 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 (arrEffectOptions){
if (this.btnParameters.menu.items.length == 0) { if (this.btnParameters.menu.items.length == 0) {
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) { arrEffectOptions.forEach(function (opt, index) {
opt.checkable = true; opt.checkable = true;
opt.toggleGroup = 'animateeffects'; opt.toggleGroup = 'animateeffects';
this.btnParameters.menu.addItem(opt); this.btnParameters.menu.addItem(opt);
(opt.value == option || option===undefined && !!opt.defvalue) && (selectedElement = this.btnParameters.menu.items[index]); (opt.value == option || option===undefined && !!opt.defvalue) && (selectedElement = this.btnParameters.menu.items[index]);
}, this); }, this);
}
(effect && effect.familyEffect) && this.btnParameters.menu.addItem({caption: '--'}); (effect && effect.familyEffect) && this.btnParameters.menu.addItem({caption: '--'});
} else { } else {
this.btnParameters.menu.clearAll(); this.btnParameters.menu.clearAll();
this.btnParameters.menu.items.forEach(function (opt) { 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; selectedElement = opt;
},this); },this);
} }
selectedElement && selectedElement.setChecked(true); !(effectGroup==='menu-effect-group-path' && effectId===AscFormat.MOTION_CUSTOM_PATH) && selectedElement && selectedElement.setChecked(true);
} }
if (effect && effect.familyEffect){ if (effect && effect.familyEffect){
if (this._familyEffect != 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) { effectsArray.forEach(function (opt) {
opt.checkable = true; opt.checkable = true;
opt.toggleGroup = 'animatesimilareffects' opt.toggleGroup = 'animatesimilareffects'

View file

@ -245,6 +245,9 @@
"Common.define.effectData.textWipe": "Wipe", "Common.define.effectData.textWipe": "Wipe",
"Common.define.effectData.textZigzag": "Zigzag", "Common.define.effectData.textZigzag": "Zigzag",
"Common.define.effectData.textZoom": "Zoom", "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.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.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", "Common.Translation.warnFileLockedBtnEdit": "Create a copy",