add AnimationDialog

This commit is contained in:
OVSharova 2021-12-01 08:08:41 +03:00
parent ee55ea6bd9
commit b304b01e9b
4 changed files with 396 additions and 266 deletions

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,8 @@ define([
'jquery',
'underscore',
'backbone',
'presentationeditor/main/app/view/Animation'
'presentationeditor/main/app/view/Animation',
'presentationeditor/main/app/view/AnimationDialog'
], function () {
'use strict';
@ -130,22 +131,30 @@ define([
}
},
onAnimationPane: function(combo, record) {
onAnimationPane: function() {
(new PE.Views.AnimationDialog({
api: this.api,
activEffect: this.Effect
})).show();
},
onAddAnimation: function() {
onAddAnimation: function(combo, record) {
var type = record.get('value');
var parameter;
var group = Common.define.effectData.getEffectGroupData().findWhere({id: record.group}).value;
if (this._state.Effect !== type) {
parameter= this.view.setMenuParameters(type, undefined, group == this._state.EffectGroups);
this.addNewEffect(type, group);
this._state.EffectGroups = group;
this._state.Effect = type;
},
addNewEffect: function (type, group) {
if (this._state.Effect == type) return;
var parameter= this.view.setMenuParameters(type, undefined, group == this._state.EffectGroups);
this.api.asc_AddAnimation(this._state.EffectGroups, type, parameter);
if (parameter!= undefined)
this.onParameterClick(parameter);
}
this._state.EffectGroups = group;
this._state.Effect = type;
},
onDurationChange: function(field, newValue, oldValue, eOpts) {
@ -166,16 +175,8 @@ define([
onEffectSelect: function (combo, record) {
var type = record.get('value');
var parameter;
var group = _.findWhere(Common.define.effectData.getEffectGroupData(),{id: record.get('group')}).value;
if (this._state.Effect !== type) {
parameter= this.view.setMenuParameters(type, undefined, group != this._state.EffectGroups);
this.api.asc_AddAnimation(group, type, parameter);
if (parameter!= undefined) {
this.onParameterClick(parameter);
}
//else this.api.asc_AddAnimation(group, type,-1);
}
this.addNewEffect(type, group);
this._state.EffectGroups = group;
this._state.Effect = type;
},

View file

@ -102,7 +102,7 @@ define([
me.cmbStart.on('selected',function (combo, record)
{
me.fireEvent('animation:startselect',[combo, record])
})
});
}
if (me.numRepeat) {
@ -133,7 +133,7 @@ define([
var _set = PE.enumLock;
this.lockedControls = [];
this._arrEffectName = [{group:'none', value: -10, iconCls: 'transition-none', caption: this.textNone}];
this._arrEffectName = [{group:'none', value: -10, iconCls: 'transition-none', displayValue: this.textNone}];
Array.prototype.push.apply( this._arrEffectName, Common.define.effectData.getEffectData());
this._arrEffectOptions = [];
this.listEffects = new Common.UI.ComboDataView({
@ -173,7 +173,7 @@ define([
this.listEffects.fieldPicker.itemTemplate = _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + (this.listEffects.itemWidth) + 'px;height: ' + (this.listEffects.itemHeight) + 'px;">',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= caption %></div>',
'<div class = "caption"><%= displayValue %></div>',
'</div>'
].join(''));
this.listEffects.menuPicker.itemTemplate = this.listEffects.fieldPicker.itemTemplate;

View file

@ -0,0 +1,128 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* AnimationDialog.js
*
* Created by Olga Sharova on 29/11/21
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
define([
'common/main/lib/component/Window'
], function () { 'use strict';
PE.Views.AnimationDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
height: 426,
header: true,
cls: 'animation-dlg',
buttons: ['ok', 'cancel']
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box" style="width: 318px; margin: 0 auto">',
'<div class = "input-row" id = "animation-group"></div>',
'<div class = "input-row" id = "animation-level" ></div>',
'<div class = "input-row" id = "animation-list" style = "margin-top: 16px; height: 216px;"></div>',
'<div class = "input-row" id = "animation-setpreview" style = "margin: 16px 0;"></div>',
'</div>'
].join('');
this.allEffects = Common.define.effectData.getEffectFullData();
this.options.tpl = _.template(this.template)(this.options);
this.api = this.options.api;
this.activEffect = this.options.Effect;
if (this.activEffect != undefined) {
var itemEffect= this.allEffects.findWhere({value: this.activEffect});
this.activeGroup = itemEffect.group;
this.activeLevel = itemEffect.level;
}
Common.UI.Window.prototype.initialize.call(this, this.options);
},
setEvents: function() {
this.cmbGroup.on('selected', _.bind(this.onGroupSelect,this));
} ,
render: function() {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild();
var footer = $window.find('.footer');
footer.css({"text-align": "center"});
this.cmbGroup = new Common.UI.ComboBox({
el : $('#animation-group'),
cls: 'input-group-nr',
editable: false,
style : 'margin-top: 16px; width: 100%;',
takeFocusOnClose: true,
data : Common.define.effectData.getEffectGroupData(),
value : (this.activEffect != undefined)?this.activeGroup:undefined
});
this.cmbLevel = new Common.UI.ComboBox({
el : $('#animation-level'),
cls: 'input-group-nr',
editable: false,
style : 'margin-top: 16px; width: 100%;',
takeFocusOnClose: true,
data : Common.define.effectData.getLevelEffect(false)
});
this.lstEffectList = new Common.UI.ListView({
el : $('#animation-list'),
scroll : true,
data : (this.activEffect != undefined)?this.allEffects.where({group: this.activeGroup, level: this.activeLevel}):undefined
});
this.chPreview = new Common.UI.CheckBox({
el : $('#animation-setpreview'),
labelText : this.textPreviewEffect
});
this.setEvents.call(this);
},
onGroupSelect: function (combo, record) {
this.activeGroup = record.value;
this.cmbLevel.data=Common.define.effectData.getLevelEffect(record.id == 'menu-effect-group-path');
this.cmbLevel.setValue(this.cmbLevel.data[0].displayValue);
},
textTitle: 'More Effects',
textPreviewEffect: 'Preview Effect'
}, PE.Views.AnimationDialog || {}));
});