[PE] Animation dialog refactoring: support preview options, support focus

This commit is contained in:
Julia Radzhabova 2022-01-19 22:11:48 +03:00
parent 650e2d9e21
commit f54cc3e381
2 changed files with 19 additions and 4 deletions

View file

@ -184,7 +184,7 @@ define([
addNewEffect: function (type, group, groupName, replace) { addNewEffect: function (type, group, groupName, replace) {
if (this._state.Effect == type && this._state.EffectGroup == group && replace) return; if (this._state.Effect == type && this._state.EffectGroup == group && replace) return;
var parameter = this.view.setMenuParameters(type, groupName, undefined); var parameter = this.view.setMenuParameters(type, groupName, undefined);
this.api.asc_AddAnimation(group, type, (parameter != undefined)?parameter:0, replace); this.api.asc_AddAnimation(group, type, (parameter != undefined)?parameter:0, replace, !Common.Utils.InternalSettings.get("pe-animation-no-preview"));
this._state.EffectGroup = group; this._state.EffectGroup = group;
this._state.Effect = type; this._state.Effect = type;
}, },

View file

@ -119,14 +119,16 @@ define([
this.lstEffectList = new Common.UI.ListView({ this.lstEffectList = new Common.UI.ListView({
el : $('#animation-list'), el : $('#animation-list'),
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style=""><%= displayValue %></div>'), itemTemplate: _.template('<div id="<%= id %>" class="list-item" style=""><%= displayValue %></div>'),
scroll : true scrollAlwaysVisible: true,
tabindex: 1
}); });
this.lstEffectList.on('item:select', _.bind(this.onEffectListItem,this)); this.lstEffectList.on('item:select', _.bind(this.onEffectListItem,this));
this.chPreview = new Common.UI.CheckBox({ this.chPreview = new Common.UI.CheckBox({
el : $('#animation-setpreview'), el : $('#animation-setpreview'),
labelText : this.textPreviewEffect labelText : this.textPreviewEffect,
}); value: !Common.Utils.InternalSettings.get("pe-animation-no-preview")
}).on('change', _.bind(this.onPreviewChange, this));
this.cmbGroup.setValue(this._state.activeGroupValue); this.cmbGroup.setValue(this._state.activeGroupValue);
this.fillLevel(); this.fillLevel();
@ -134,6 +136,14 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
}, },
getFocusedComponents: function() {
return [ this.cmbGroup, this.cmbLevel, this.lstEffectList, this.chPreview];
},
getDefaultFocusableComponent: function () {
return this.lstEffectList;
},
onGroupSelect: function (combo, record) { onGroupSelect: function (combo, record) {
this._state.activeGroup = record.id; this._state.activeGroup = record.id;
this._state.activeGroupValue = record.value; this._state.activeGroupValue = record.value;
@ -164,6 +174,7 @@ define([
if(!item) if(!item)
item = this.lstEffectList.store.at(0); item = this.lstEffectList.store.at(0);
this.lstEffectList.selectRecord(item); this.lstEffectList.selectRecord(item);
this.lstEffectList.scrollToRecord(item, true);
this._state.activeEffect = item.get('value'); this._state.activeEffect = item.get('value');
}, },
@ -173,6 +184,10 @@ define([
} }
}, },
onPreviewChange: function (field, newValue, oldValue, eOpts) {
Common.Utils.InternalSettings.set("pe-animation-no-preview", field.getValue()!=='checked');
},
onBtnClick: function (event) onBtnClick: function (event)
{ {
this._handleInput(event.currentTarget.attributes['result'].value); this._handleInput(event.currentTarget.attributes['result'].value);