Add action from dialog

This commit is contained in:
OVSharova 2021-12-08 04:28:30 +03:00
parent 4e3fcb38aa
commit 01cf4e1eb3
3 changed files with 48 additions and 12 deletions

View file

@ -815,6 +815,7 @@ define(function(){ 'use strict';
{group: 'menu-effect-group-entrance', value: AscFormat.ENTRANCE_ZOOM, iconCls: 'transition-zoom', displayValue: this.textZoom},
{group: 'menu-effect-group-entrance', value: AscFormat.ENTRANCE_SWIVEL, iconCls: 'transition-push', displayValue: this.textSwivel},
{group: 'menu-effect-group-entrance', value: AscFormat.ENTRANCE_BOUNCE, iconCls: 'transition-push', displayValue: this.textBounce},
{group: 'menu-effect-group-entrance', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-push', displayValue: this.textFillColor, isHide: true},
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_PULSE, iconCls: 'transition-push', displayValue: this.textPulse},
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_COLOR_PULSE, iconCls: 'transition-push', displayValue: this.textColorPulse},
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_TEETER, iconCls: 'transition-push', displayValue: this.textTeeter},
@ -828,6 +829,7 @@ define(function(){ 'use strict';
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_COMPLEMENTARY_COLOR, iconCls: 'transition-push', displayValue: this.textComplementaryColor},
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_LINE_COLOR, iconCls: 'transition-push', displayValue: this.textLineColor},
{group: 'menu-effect-group-emphasis', value: AscFormat.EMPHASIS_FILL_COLOR, iconCls: 'transition-push', displayValue: this.textFillColor},
{group: 'menu-effect-group-emphasis', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-push', displayValue: this.textFillColor, isHide: true},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_DISAPPEAR, iconCls: 'transition-push', displayValue: this.textDisappear},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_FADE, iconCls: 'transition-push', displayValue: this.textFade},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_FLY_OUT_TO, iconCls: 'transition-push', displayValue: this.textFlyOut},
@ -844,6 +846,7 @@ define(function(){ 'use strict';
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_ZOOM, iconCls: 'transition-push', displayValue: this.textZoom},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_BASIC_SWIVEL, iconCls: 'transition-push', displayValue: this.textSwivel},
{group: 'menu-effect-group-exit', value: AscFormat.EXIT_BOUNCE, iconCls: 'transition-push', displayValue: this.textBounce},
{group: 'menu-effect-group-exit', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-push', displayValue: this.textFillColor, isHide: true},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_DOWN, iconCls: 'transition-push', displayValue: this.textDown},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_LEFT, iconCls: 'transition-push', displayValue: this.textLeft},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_RIGHT, iconCls: 'transition-push', displayValue: this.textRight},
@ -869,7 +872,9 @@ define(function(){ 'use strict';
{group: 'menu-effect-group-path', value: AscFormat.MOTION_HORIZONTAL_FIGURE_8_FOUR, iconCls: 'transition-push', displayValue: this.textHorizontalFigure},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_VERTICAL_FIGURE_8, iconCls: 'transition-push', displayValue: this.textVerticalFigure},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_LOOP_DE_LOOP, iconCls: 'transition-push', displayValue: this.textLoopDeLoop},
{group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'transition-push', displayValue: this.textCustomPath}
{group: 'menu-effect-group-path', value: AscFormat.MOTION_CUSTOM_PATH, iconCls: 'transition-push', displayValue: this.textCustomPath},
{group: 'menu-effect-group-path', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'transition-push', displayValue: this.textFillColor, isHide: true}
];
},

View file

@ -140,9 +140,17 @@ define([
},
onAnimationAdditional: function(replace) { // replace or add new additional effect
var me = this;
(new PE.Views.AnimationDialog({
api : this.api,
activeEffect : this._state.Effect
activeEffect : this._state.Effect,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
me.addNewEffect(value.activeEffect, value.activeGroupValue, replace);
}
}
}
})).show();
},
@ -378,8 +386,6 @@ define([
obj.setChecked(true);
//me.cmbTrigger.setCaption(obj.caption);
}
},
setTriggerList: function (){
@ -390,7 +396,6 @@ define([
this.objectNames.forEach(function (item){
btnMemnu.addItem({ caption: item, checkable: true, toggleGroup: 'animtrigger'});
});
}
}, PE.Controllers.Animation || {}));

View file

@ -64,12 +64,15 @@ define([
this.allEffects = Common.define.effectData.getEffectFullData();
this.options.tpl = _.template(this.template)(this.options);
this.api = this.options.api;
this.activeEffect = this.options.Effect;
this._state=[];
this.handler = this.options.handler;
this.EffectGroupData = Common.define.effectData.getEffectGroupData();
this.EffectGroupData.forEach(function (item) {item.displayValue = item.caption;});
if (this.activeEffect != undefined) {
var itemEffect= this.allEffects.findWhere({value: this.activeEffect});
this.activeGroup = itemEffect.group;
if (this.options.Effect != undefined) {
this._state.activeEffect = this.options.Effect;
var itemEffect= this.allEffects.findWhere({value: this._state.activeEffect});
this._state.activeGroup = itemEffect.group;
this._state.activeGroupValue = this.EffectGroupData.findWhere({id: this._state.activeGroup});
this.activeLevel = itemEffect.level;
}
Common.UI.Window.prototype.initialize.call(this, this.options);
@ -90,7 +93,7 @@ define([
style : 'margin-top: 16px; width: 100%;',
takeFocusOnClose: true,
data : this.EffectGroupData,
value : (this.activEffect != undefined)?this.activeGroup:undefined
value : (this._state.activeEffect != undefined)?this._state.activeGroup:undefined
});
this.cmbGroup.on('selected', _.bind(this.onGroupSelect,this));
@ -108,6 +111,7 @@ define([
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style=""><%= displayValue %></div>'),
scroll : true
});
this.lstEffectList.on('item:select', _.bind(this.onEffectListItem,this));
this.chPreview = new Common.UI.CheckBox({
el : $('#animation-setpreview'),
@ -115,10 +119,13 @@ define([
});
this.cmbGroup.selectRecord(this.cmbGroup.store.models[0]);
this.onGroupSelect(undefined,this.cmbGroup.store.models[0]);
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
onGroupSelect: function (combo, record) {
this.activeGroup = record.id;
this._state.activeGroup = record.id;
this._state.activeGroupValue = record.get('value');
this.cmbLevel.store.reset(Common.define.effectData.getLevelEffect(record.id == 'menu-effect-group-path'));
this.cmbLevel.selectRecord(this.cmbLevel.store.models[0]);
this.onLevelSelect(undefined,this.cmbLevel.store.models[0]);
@ -126,11 +133,30 @@ define([
onLevelSelect: function (combo, record) {
this.activeLevel = record.id;
var arr = _.where(this.allEffects, {group: this.activeGroup, level: this.activeLevel });
var arr = _.where(this.allEffects, {group: this._state.activeGroup, level: this.activeLevel });
this.lstEffectList.store.reset(arr);
this.lstEffectList.selectRecord(this.lstEffectList.store.models[0]);
},
onEffectListItem: function (lisvView, itemView, record){
if (record) {
this._state.activeEffect = record.get('value');
}
},
onBtnClick: function (event)
{
this._handleInput(event.currentTarget.attributes['result'].value);
},
_handleInput: function(state) {
if (this.options.handler) {
this.options.handler.call(this, state, this._state);
}
this.close();
},
textTitle: 'More Effects',
textPreviewEffect: 'Preview Effect'