From 9b5420e7b10347d5cbb21fb0be1696e756c7f900 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sat, 18 Dec 2021 00:16:39 +0300 Subject: [PATCH] [PE] Animation: fix position for "Multiple" item. Remove custom effect from list for multiple effects --- apps/common/main/lib/component/DataView.js | 17 ++++++++++++++--- .../main/app/controller/Animation.js | 3 +-- .../main/app/view/Animation.js | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index a7d8fa820..bc50d891a 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -447,13 +447,24 @@ define([ } } + var idx = _.indexOf(this.store.models, record); if (innerEl) { - if (opts && opts.at == 0) - innerEl.prepend(view.render().el); else + if (opts && (typeof opts.at==='number') && opts.at >= 0) { + if (opts.at == 0) { + innerEl.prepend(view.render().el); + } else if (!(this.groups && this.groups.length > 0)) { // for dataview without groups + var innerDivs = innerEl.find('> div'); + if (idx > 0) + $(innerDivs.get(idx - 1)).after(view.render().el); + else { + (innerDivs.length > 0) ? $(innerDivs[idx]).before(view.render().el) : innerEl.append(view.render().el); + } + } else + innerEl.append(view.render().el); + } else innerEl.append(view.render().el); (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); - var idx = _.indexOf(this.store.models, record); this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx)); var me = this, diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index e7f00d5cd..4069316cb 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -306,6 +306,7 @@ define([ view.listEffects.fillComboView(item, true, forceFill); view.btnParameters.setIconCls('toolbar__icon icon ' + item.get('iconCls')); } else { + store.remove(store.findWhere({isCustom: true})); // remove custom effects if (this._state.Effect==AscFormat.ANIM_PRESET_MULTIPLE) { // add and select "multiple" item view.listEffects.fillComboView(store.at(0), false, true); fieldStore.remove(fieldStore.at(fieldStore.length-1)); @@ -318,8 +319,6 @@ define([ view.listEffects.menuPicker.deselectAll(); } else { // add custom effect to appropriate group if (group) { - store.remove(store.findWhere({isCustom: true})); // remove other custom effects - var items = store.where({group: group.get('id')}); var index = (items && items.length>0) ? store.indexOf(items.at(items.length-1)) : store.length-1; var rec = _.findWhere(Common.define.effectData.getEffectFullData(), {group: group.get('id'), value: this._state.Effect}); diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 1703847a3..e29ae88ee 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -400,7 +400,7 @@ define([ accept(); })).then(function() { me.btnAddAnimation.setMenu( new Common.UI.Menu({ - style: 'width: 370px;padding-top: 12px;', + style: 'width: 375px;padding-top: 12px;', items: [ {template: _.template('')}, {caption: '--'},