From b09f44f94f13bbeea57a4fc57c1b91df332c7332 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Tue, 19 Oct 2021 18:00:09 +0300 Subject: [PATCH] Set Functions --- .../main/app/controller/Animation.js | 71 ++++++++++++++----- .../main/app/template/Toolbar.template | 12 ++-- .../main/app/view/Animation.js | 4 +- .../main/resources/less/transitions.less | 2 +- 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index 66c3a42a6..755d882f8 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -63,10 +63,13 @@ define([ this.addListeners({ 'PE.Views.Animation': { 'animation:preview': _.bind(this.onPreviewClick, this), - 'animation:parameters': _.bind(this.onParameterClick, this), + 'animation:parameters': _.bind(this.onParameterClick, this), 'animation:duration': _.bind(this.onDurationChange, this), 'animation:selecteffect': _.bind(this.onEffectSelect, this), 'animation:delay': _.bind(this.onDelayChange, this), + 'animation:animationpane':_.bind(this.onAnimationPane, this), + 'animation:addeffect': _.bind(this.onAddEffect, this), + 'animation:startselect': _.bind(this.onStartSelect, this), }, 'Toolbar': { 'tab:active': _.bind(this.onActiveTab, this) @@ -117,35 +120,39 @@ define([ }, onParameterClick: function (item) { - this.EffectType = item.value; + this._state.EffectType = item.value; + + }, + + onAnimationPane: function() { + + }, + + onAddEffect: function() { }, onDurationChange: function(field, newValue, oldValue, eOpts) { - + this._state.Duration = field.getNumberValue()*1000; }, - - onDelayChange: function(field, newValue, oldValue, eOpts) { - + this._state.Delay = field.getNumberValue()*1000; }, - onCheckDelayChange: function(field, newValue, oldValue, eOpts) { - - }, - - - onEffectSelect: function (combo, record) { var type = record.get('value'); - if (this.Effect !== type) { + if (this._state.Effect !== type) { var parameter = this.view.setMenuParameters(type); if (parameter) this.onParameterClick(parameter); } - this.Effect = type; + this._state.Effect = type; + + }, + + onStartSelect: function (combo, record) { }, @@ -160,7 +167,7 @@ define([ if (eltype == Asc.c_oAscTypeSelectElement.Slide) { - //this.loadSettings(pr); + this.loadSettings(); if (this._state.onactivetab) { this.setLocked(); @@ -170,8 +177,25 @@ define([ } }, - loadSettings: function (props) { + loadSettings: function () { + this._state.Effect = !this._state.Effect ? 2 : this._state.Effect; + this._state.EffectType = !this._state.EffectType ? this.view.setMenuParameters(this._state.Effect): this._state.EffectType; + var value = 1000; + if (Math.abs(this._state.Duration - value) > 0.001 || + (this._state.Duration === null || value === null) && (this._state.Duration !== value) || + (this._state.Duration === undefined || value === undefined) && (this._state.Duration !== value)) { + this._state.Duration = value; + } + + value = 1000; + if (Math.abs(this._state.Delay - value) > 0.001 || + (this._state.Delay === null || value === null) && (this._state.Delay !== value) || + (this._state.Delay === undefined || value === undefined) && (this._state.Delay !== value)) { + this._state.Delay = value; + } + + this._state.StartSelect = 0; }, onActiveTab: function(tab) { @@ -194,6 +218,21 @@ define([ setSettings: function () { var me = this.view; + + if (this._state.Effect !== undefined) { + var 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')); + } + + if (me.btnParameters.menu.items.length > 0 && this._state.EffectType !== undefined) + me.setMenuParameters(this._state.Effect, this._state.EffectType); + + me.numDuration.setValue((this._state.Duration !== null && this._state.Duration !== undefined) ? this._state.Duration / 1000. : '', true); + me.numDelay.setValue((this._state.Delay !== null && this._state.Delay !== undefined) ? this._state.Delay / 1000. : '', true); + item = me.cmbStart.store.findWhere({value: this._state.StartSelect}); + me.cmbStart.selectRecord(item ? item : me.cmbStart.items[0]); + } }, PE.Controllers.Animation || {})); diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 27a38b2fb..c6646b310 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -185,10 +185,10 @@
-
+
- +
@@ -196,17 +196,17 @@
-
+
-
+
- +
-
+
diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 8c5be02f0..cd28b6a9b 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -233,7 +233,7 @@ define([ this.numDuration = new Common.UI.MetricSpinner({ el: this.$el.find('#animation-spin-duration'), step: 1, - width: 50, + width: 52, value: '', defaultUnit: this.txtSec, maxValue: 300, @@ -248,7 +248,7 @@ define([ this.numDelay = new Common.UI.MetricSpinner({ el: this.$el.find('#animation-spin-delay'), step: 1, - width: 60, + width: 52, value: '', defaultUnit: this.txtSec, maxValue: 300, diff --git a/apps/presentationeditor/main/resources/less/transitions.less b/apps/presentationeditor/main/resources/less/transitions.less index 4fcf450f5..fc836eabc 100644 --- a/apps/presentationeditor/main/resources/less/transitions.less +++ b/apps/presentationeditor/main/resources/less/transitions.less @@ -1,4 +1,4 @@ -#transitions-panel { +#transitions-panel,#animation-panel { .item { background: transparent; border-color: transparent;