diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index da5b9b674..6f2657d67 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -73,7 +73,9 @@ define([ 'animation:startselect': _.bind(this.onStartSelect, this), 'animation:checkrewind': _.bind(this.onCheckRewindChange,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': { 'tab:active': _.bind(this.onActiveTab, this) @@ -181,6 +183,32 @@ define([ 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) { if (this.api) { var type = record.get('value'); @@ -288,6 +316,16 @@ define([ 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.RepeatCount = this.AnimationProperties.asc_getRepeatCount(); this._state.Rewind = this.AnimationProperties.asc_getRewind(); @@ -315,10 +353,11 @@ define([ setSettings: function () { var me = this.view; var item; + this.setTriggerList(); if (this._state.Effect !== undefined) { item = me.listEffects.store.findWhere({value: this._state.Effect}); 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) @@ -332,6 +371,26 @@ define([ item = me.cmbStart.store.findWhere({value: this._state.StartSelect}); me.cmbStart.selectRecord(item); 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 || {})); diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 566d4ed00..fd3c8069f 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -216,7 +216,7 @@
-
+
diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 067d5d01e..cef79c7e9 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -74,6 +74,16 @@ define([ }, 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) { me.btnParameters.menu.on('item:click', function (menu, item, e) { me.fireEvent('animation:parameters', [item.value]); @@ -126,6 +136,11 @@ define([ initialize: function (options) { + this.triggers= { + ClickSequence: 0, + ClickOf: 1 + } + Common.UI.BaseView.prototype.initialize.call(this, options); this.toolbar = options.toolbar; this.appConfig = options.mode; @@ -152,9 +167,8 @@ define([ ].join('')), groups: new Common.UI.DataViewGroupStore([{id: 'none', value: -10, caption: this.textNone}].concat(Common.define.effectData.getEffectGroupData())), store: new Common.UI.DataViewStore(this._arrEffectName), - additionalMenuItems: [{caption: '--'}, this.listEffectsMore], enableKeyEvents: true, - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: '-16, 0', @@ -187,7 +201,7 @@ define([ caption: this.txtPreview, split: false, iconCls: 'toolbar__icon preview-transitions', - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], + lock: [_set.slideDeleted, _set.noSlides], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' @@ -199,7 +213,7 @@ define([ caption: this.txtParameters, iconCls: 'toolbar__icon icon transition-none', menu: new Common.UI.Menu({items: []}), - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -211,7 +225,7 @@ define([ caption: this.txtAnimationPane, split: true, iconCls: 'toolbar__icon transition-apply-all', - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' @@ -223,7 +237,7 @@ define([ caption: this.txtAddEffect, iconCls: 'toolbar__icon icon btn-addslide', menu: true, - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -239,26 +253,42 @@ define([ defaultUnit: this.txtSec, maxValue: 300, minValue: 0, - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'top', dataHintOffset: 'small' }); this.lockedControls.push(this.numDuration); - this.cmbTrigger = new Common.UI.ComboBox({ - cls: 'input-group-nr', - menuStyle: 'width: 150px;', - //lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], - data: [ - {value: 0, displayValue: '1-1'}, - {value: 1, displayValue: '2-2'}, - {value: 2, displayValue: '3-3'} - ], - dataHint: '1', - dataHintDirection: 'top' - }); + this.cmbTrigger = new Common.UI.Button({ + parentEl: $('#animation-trigger'), + cls: 'btn-text-split-default', + split: true, + width: 82, + menu : new Common.UI.Menu({ + style : 'min-width: 150px;', + items: [ + { + caption: this.textOnClickSequence, + 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.btnClickOf = this.cmbTrigger.menu.items[1]; this.numDelay = new Common.UI.MetricSpinner({ el: this.$el.find('#animation-spin-delay'), @@ -268,7 +298,7 @@ define([ defaultUnit: this.txtSec, maxValue: 300, minValue: 0, - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'big' @@ -278,7 +308,7 @@ define([ this.cmbStart = new Common.UI.ComboBox({ cls: 'input-group-nr', menuStyle: 'width: 150px;', - //lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], data: [ {value: AscFormat.NODE_TYPE_CLICKEFFECT, displayValue: this.textStartOnClick}, {value: AscFormat.NODE_TYPE_WITHEFFECT, displayValue: this.textStartWithPrevious}, @@ -292,7 +322,7 @@ define([ this.chRewind = new Common.UI.CheckBox({ el: this.$el.find('#animation-checkbox-rewind'), labelText: this.strRewind, - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -307,7 +337,7 @@ define([ maxValue: 1000, minValue: 0, defaultUnit: '', - //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], + lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'big' @@ -387,7 +417,7 @@ define([ this.btnAnimationPane && this.btnAnimationPane.render(this.$el.find('#animation-button-pane')); this.btnAddAnimation && this.btnAddAnimation.render(this.$el.find('#animation-button-add-effect')); 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-delay', this.numDelay); 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-trigger").innerText = this.strTrigger; this.$el.find("#animation-repeat").innerText = this.strRepeat; - this.widthRow(this.$el.find("#animation-label-start"), this.$el.find("#animation-delay")); return this.$el; }, @@ -405,20 +434,7 @@ define([ 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 () { Common.UI.BaseView.prototype.show.call(this); @@ -437,11 +453,6 @@ define([ }, 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) { var effect = this.listEffects.store.findWhere({value: effectId}); @@ -491,6 +502,8 @@ define([ textStartOnClick: 'On Click', textStartWithPrevious: 'With Previous', textStartAfterPrevious: 'After Previous', + textOnClickSequence: 'On Click Sequence', + textOnClickOf: 'On Click of', textNone: 'None', textMoreEffects: 'Show More Effects' } diff --git a/apps/presentationeditor/main/app/view/AnimationDialog.js b/apps/presentationeditor/main/app/view/AnimationDialog.js index e465cc387..f6d2f3862 100644 --- a/apps/presentationeditor/main/app/view/AnimationDialog.js +++ b/apps/presentationeditor/main/app/view/AnimationDialog.js @@ -65,6 +65,8 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; this.activeEffect = this.options.Effect; + 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; @@ -87,7 +89,7 @@ define([ editable: false, style : 'margin-top: 16px; width: 100%;', takeFocusOnClose: true, - data : Common.define.effectData.getEffectGroupData(), + data : this.EffectGroupData, value : (this.activEffect != undefined)?this.activeGroup:undefined }); this.cmbGroup.on('selected', _.bind(this.onGroupSelect,this));