Merge remote-tracking branch 'origin/feature/animation_tab' into feature/animation_tab

This commit is contained in:
Julia Radzhabova 2021-12-07 11:37:09 +03:00
commit 4e3fcb38aa
4 changed files with 122 additions and 48 deletions

View file

@ -73,7 +73,9 @@ define([
'animation:startselect': _.bind(this.onStartSelect, this), 'animation:startselect': _.bind(this.onStartSelect, this),
'animation:checkrewind': _.bind(this.onCheckRewindChange,this), 'animation:checkrewind': _.bind(this.onCheckRewindChange,this),
'animation:repeat': _.bind(this.onRepeatChange, this), 'animation:repeat': _.bind(this.onRepeatChange, this),
'animation:additional': _.bind(this.onAnimationAdditional, this) 'animation:additional': _.bind(this.onAnimationAdditional, this),
'animation:trigger': _.bind(this.onTriggerClick, this),
'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this)
}, },
'Toolbar': { 'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this) 'tab:active': _.bind(this.onActiveTab, this)
@ -181,6 +183,32 @@ define([
this.api.asc_SetAnimationProperties(this.AnimationProperties); this.api.asc_SetAnimationProperties(this.AnimationProperties);
} }
}, },
onTriggerClick: function (value) {
if(this.api) {
if(value==this.view.triggers.ClickSequence)
{
this._state.Trigger = this.view.triggers.ClickSequence;
this._state.TriggerValue = true;
this.AnimationProperties.asc_putTriggerClickSequence(this._state.TriggerValue);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
}
}
},
onTriggerClickOfClick: function (value)
{
if(this.api)
{
this._state.Trigger = this.view.triggers.ClickOf;
this._state.TriggerValue = value.caption;
this.AnimationProperties.asc_putTriggerClickSequence(false);
this.AnimationProperties.asc_putTriggerObjectClick(this._state.TriggerValue);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
}
},
onEffectSelect: function (combo, record) { onEffectSelect: function (combo, record) {
if (this.api) { if (this.api) {
var type = record.get('value'); var type = record.get('value');
@ -288,6 +316,16 @@ define([
this._state.Repeat = value; this._state.Repeat = value;
} }
if(this.AnimationProperties.asc_getTriggerClickSequence()) {
this._state.trigger = this.view.triggers.ClickSequence;
this._state.TriggerValue = true;
}
else
{
this._state.trigger = this.view.triggers.ClickOf;
this._state.TriggerValue = this.AnimationProperties.asc_getTriggerObjectClick();
}
this._state.StartSelect = this.AnimationProperties.asc_getStartType(); this._state.StartSelect = this.AnimationProperties.asc_getStartType();
this._state.RepeatCount = this.AnimationProperties.asc_getRepeatCount(); this._state.RepeatCount = this.AnimationProperties.asc_getRepeatCount();
this._state.Rewind = this.AnimationProperties.asc_getRewind(); this._state.Rewind = this.AnimationProperties.asc_getRewind();
@ -315,10 +353,11 @@ define([
setSettings: function () { setSettings: function () {
var me = this.view; var me = this.view;
var item; var item;
this.setTriggerList();
if (this._state.Effect !== undefined) { if (this._state.Effect !== undefined) {
item = me.listEffects.store.findWhere({value: this._state.Effect}); item = me.listEffects.store.findWhere({value: this._state.Effect});
me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]); me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]);
this.view.btnParameters.setIconCls('toolbar__icon icon ' + item.get('imageUrl')); this.view.btnParameters.setIconCls('toolbar__icon icon ' + item.get('iconCls'));
} }
if (this._state.EffectOption !== undefined) if (this._state.EffectOption !== undefined)
@ -332,6 +371,26 @@ define([
item = me.cmbStart.store.findWhere({value: this._state.StartSelect}); item = me.cmbStart.store.findWhere({value: this._state.StartSelect});
me.cmbStart.selectRecord(item); me.cmbStart.selectRecord(item);
me.chRewind.setValue(this._state.Rewind, true); me.chRewind.setValue(this._state.Rewind, true);
var obj;
obj =(this._state.trigger == me.triggers.ClickSequence)?me.cmbTrigger.menu.items[0] : _.findWhere(me.btnClickOf.menu.items,{caption: this._state.TriggerValue});
if(obj) {
obj.setChecked(true);
//me.cmbTrigger.setCaption(obj.caption);
}
},
setTriggerList: function (){
this.objectNames = this.api.asc_getCurSlideObjectsNames();
if(this.countObjects == this.objectNames.length) return;
this.view.btnClickOf.menu.removeAll();
var btnMemnu=this.view.btnClickOf.menu;
this.objectNames.forEach(function (item){
btnMemnu.addItem({ caption: item, checkable: true, toggleGroup: 'animtrigger'});
});
} }
}, PE.Controllers.Animation || {})); }, PE.Controllers.Animation || {}));

View file

@ -216,7 +216,7 @@
</div> </div>
<div class="elset font-normal"> <div class="elset font-normal">
<label id="animation-label-trigger"></label> <label id="animation-label-trigger"></label>
<div class="btn-slot" style="width: 82px; " id="animation-trigger"></div> <div class="btn-slot" style="width: 82px;" id="animation-trigger"></div>
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>

View file

@ -74,6 +74,16 @@ define([
}, me)); }, me));
} }
if(me.cmbTrigger)
{
me.cmbTrigger.menu.on('item:click', _.bind(function(menu, item, e) {
me.fireEvent('animation:trigger', [item]);
}, me));
me.btnClickOf.menu.on('item:click', _.bind(function(menu, item, e) {
me.fireEvent('animation:triggerclickof', [item]);
}, me));
}
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]); me.fireEvent('animation:parameters', [item.value]);
@ -126,6 +136,11 @@ define([
initialize: function (options) { initialize: function (options) {
this.triggers= {
ClickSequence: 0,
ClickOf: 1
}
Common.UI.BaseView.prototype.initialize.call(this, options); Common.UI.BaseView.prototype.initialize.call(this, options);
this.toolbar = options.toolbar; this.toolbar = options.toolbar;
this.appConfig = options.mode; this.appConfig = options.mode;
@ -152,9 +167,8 @@ define([
].join('')), ].join('')),
groups: new Common.UI.DataViewGroupStore([{id: 'none', value: -10, caption: this.textNone}].concat(Common.define.effectData.getEffectGroupData())), groups: new Common.UI.DataViewGroupStore([{id: 'none', value: -10, caption: this.textNone}].concat(Common.define.effectData.getEffectGroupData())),
store: new Common.UI.DataViewStore(this._arrEffectName), store: new Common.UI.DataViewStore(this._arrEffectName),
additionalMenuItems: [{caption: '--'}, this.listEffectsMore],
enableKeyEvents: true, enableKeyEvents: true,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: '-16, 0', dataHintOffset: '-16, 0',
@ -187,7 +201,7 @@ define([
caption: this.txtPreview, caption: this.txtPreview,
split: false, split: false,
iconCls: 'toolbar__icon preview-transitions', iconCls: 'toolbar__icon preview-transitions',
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], lock: [_set.slideDeleted, _set.noSlides],
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
@ -199,7 +213,7 @@ define([
caption: this.txtParameters, caption: this.txtParameters,
iconCls: 'toolbar__icon icon transition-none', iconCls: 'toolbar__icon icon transition-none',
menu: new Common.UI.Menu({items: []}), menu: new Common.UI.Menu({items: []}),
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -211,7 +225,7 @@ define([
caption: this.txtAnimationPane, caption: this.txtAnimationPane,
split: true, split: true,
iconCls: 'toolbar__icon transition-apply-all', iconCls: 'toolbar__icon transition-apply-all',
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'medium' dataHintOffset: 'medium'
@ -223,7 +237,7 @@ define([
caption: this.txtAddEffect, caption: this.txtAddEffect,
iconCls: 'toolbar__icon icon btn-addslide', iconCls: 'toolbar__icon icon btn-addslide',
menu: true, menu: true,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -239,26 +253,42 @@ define([
defaultUnit: this.txtSec, defaultUnit: this.txtSec,
maxValue: 300, maxValue: 300,
minValue: 0, minValue: 0,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'top', dataHintDirection: 'top',
dataHintOffset: 'small' dataHintOffset: 'small'
}); });
this.lockedControls.push(this.numDuration); this.lockedControls.push(this.numDuration);
this.cmbTrigger = new Common.UI.ComboBox({ this.cmbTrigger = new Common.UI.Button({
cls: 'input-group-nr', parentEl: $('#animation-trigger'),
menuStyle: 'width: 150px;', cls: 'btn-text-split-default',
//lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], split: true,
data: [ width: 82,
{value: 0, displayValue: '1-1'}, menu : new Common.UI.Menu({
{value: 1, displayValue: '2-2'}, style : 'min-width: 150px;',
{value: 2, displayValue: '3-3'} items: [
], {
dataHint: '1', caption: this.textOnClickSequence,
dataHintDirection: 'top' checkable: true,
}); toggleGroup: 'animtrigger',
value: this.triggers.ClickSequence
},
{
value: this.triggers.ClickOf,
caption: this.textOnClickOf,
menu: new Common.UI.Menu({
menuAlign: 'tr-br',
items: []
})
}]
}),
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
});
this.lockedControls.push(this.cmbTrigger); this.lockedControls.push(this.cmbTrigger);
this.btnClickOf = this.cmbTrigger.menu.items[1];
this.numDelay = new Common.UI.MetricSpinner({ this.numDelay = new Common.UI.MetricSpinner({
el: this.$el.find('#animation-spin-delay'), el: this.$el.find('#animation-spin-delay'),
@ -268,7 +298,7 @@ define([
defaultUnit: this.txtSec, defaultUnit: this.txtSec,
maxValue: 300, maxValue: 300,
minValue: 0, minValue: 0,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'big' dataHintOffset: 'big'
@ -278,7 +308,7 @@ define([
this.cmbStart = new Common.UI.ComboBox({ this.cmbStart = new Common.UI.ComboBox({
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'width: 150px;', menuStyle: 'width: 150px;',
//lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
data: [ data: [
{value: AscFormat.NODE_TYPE_CLICKEFFECT, displayValue: this.textStartOnClick}, {value: AscFormat.NODE_TYPE_CLICKEFFECT, displayValue: this.textStartOnClick},
{value: AscFormat.NODE_TYPE_WITHEFFECT, displayValue: this.textStartWithPrevious}, {value: AscFormat.NODE_TYPE_WITHEFFECT, displayValue: this.textStartWithPrevious},
@ -292,7 +322,7 @@ define([
this.chRewind = new Common.UI.CheckBox({ this.chRewind = new Common.UI.CheckBox({
el: this.$el.find('#animation-checkbox-rewind'), el: this.$el.find('#animation-checkbox-rewind'),
labelText: this.strRewind, labelText: this.strRewind,
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'left', dataHintDirection: 'left',
dataHintOffset: 'small' dataHintOffset: 'small'
@ -307,7 +337,7 @@ define([
maxValue: 1000, maxValue: 1000,
minValue: 0, minValue: 0,
defaultUnit: '', defaultUnit: '',
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
dataHintOffset: 'big' dataHintOffset: 'big'
@ -387,7 +417,7 @@ define([
this.btnAnimationPane && this.btnAnimationPane.render(this.$el.find('#animation-button-pane')); this.btnAnimationPane && this.btnAnimationPane.render(this.$el.find('#animation-button-pane'));
this.btnAddAnimation && this.btnAddAnimation.render(this.$el.find('#animation-button-add-effect')); this.btnAddAnimation && this.btnAddAnimation.render(this.$el.find('#animation-button-add-effect'));
this.cmbStart && this.cmbStart.render(this.$el.find('#animation-start')); this.cmbStart && this.cmbStart.render(this.$el.find('#animation-start'));
this.cmbTrigger && this.cmbTrigger.render(this.$el.find('#animation-trigger')); //this.cmbTrigger && this.cmbTrigger.render(this.$el.find('#animation-trigger'));
this.renderComponent('#animation-spin-duration', this.numDuration); this.renderComponent('#animation-spin-duration', this.numDuration);
this.renderComponent('#animation-spin-delay', this.numDelay); this.renderComponent('#animation-spin-delay', this.numDelay);
this.renderComponent('#animation-spin-repeat', this.numRepeat); this.renderComponent('#animation-spin-repeat', this.numRepeat);
@ -396,7 +426,6 @@ define([
this.$el.find("#animation-label-start").innerText = this.strStart; this.$el.find("#animation-label-start").innerText = this.strStart;
this.$el.find("#animation-label-trigger").innerText = this.strTrigger; this.$el.find("#animation-label-trigger").innerText = this.strTrigger;
this.$el.find("#animation-repeat").innerText = this.strRepeat; this.$el.find("#animation-repeat").innerText = this.strRepeat;
this.widthRow(this.$el.find("#animation-label-start"), this.$el.find("#animation-delay"));
return this.$el; return this.$el;
}, },
@ -405,20 +434,7 @@ define([
element.parent().append(obj.el); element.parent().append(obj.el);
}, },
widthRow: function (obj1, obj2, wd) {
if(wd) return wd;
var w1 = obj1.width(),
w2 = obj2.width();
if(!w1 || !w2) return 0;
if(w1>w2) {
obj2.css('width', w1);
return w1;
}
else {
obj1.css('width', w2);
return w2;
}
},
show: function () { show: function () {
Common.UI.BaseView.prototype.show.call(this); Common.UI.BaseView.prototype.show.call(this);
@ -437,11 +453,6 @@ define([
}, this); }, this);
}, },
setWidthRow: function () {
this.widthStart = this.widthRow(this.$el.find("#animation-label-start"), this.$el.find("#animation-delay"),this.widthStart);
this.widthDuration = this.widthRow(this.$el.find("#animation-duration"), this.$el.find("#animation-label-trigger"),this.widthDuration);
},
setMenuParameters: function (effectId, option) setMenuParameters: function (effectId, option)
{ {
var effect = this.listEffects.store.findWhere({value: effectId}); var effect = this.listEffects.store.findWhere({value: effectId});
@ -491,6 +502,8 @@ define([
textStartOnClick: 'On Click', textStartOnClick: 'On Click',
textStartWithPrevious: 'With Previous', textStartWithPrevious: 'With Previous',
textStartAfterPrevious: 'After Previous', textStartAfterPrevious: 'After Previous',
textOnClickSequence: 'On Click Sequence',
textOnClickOf: 'On Click of',
textNone: 'None', textNone: 'None',
textMoreEffects: 'Show More Effects' textMoreEffects: 'Show More Effects'
} }

View file

@ -65,6 +65,8 @@ define([
this.options.tpl = _.template(this.template)(this.options); this.options.tpl = _.template(this.template)(this.options);
this.api = this.options.api; this.api = this.options.api;
this.activeEffect = this.options.Effect; this.activeEffect = this.options.Effect;
this.EffectGroupData = Common.define.effectData.getEffectGroupData();
this.EffectGroupData.forEach(function (item) {item.displayValue = item.caption;});
if (this.activeEffect != undefined) { if (this.activeEffect != undefined) {
var itemEffect= this.allEffects.findWhere({value: this.activeEffect}); var itemEffect= this.allEffects.findWhere({value: this.activeEffect});
this.activeGroup = itemEffect.group; this.activeGroup = itemEffect.group;
@ -87,7 +89,7 @@ define([
editable: false, editable: false,
style : 'margin-top: 16px; width: 100%;', style : 'margin-top: 16px; width: 100%;',
takeFocusOnClose: true, takeFocusOnClose: true,
data : Common.define.effectData.getEffectGroupData(), data : this.EffectGroupData,
value : (this.activEffect != undefined)?this.activeGroup:undefined value : (this.activEffect != undefined)?this.activeGroup:undefined
}); });
this.cmbGroup.on('selected', _.bind(this.onGroupSelect,this)); this.cmbGroup.on('selected', _.bind(this.onGroupSelect,this));