Set Functions

This commit is contained in:
OVSharova 2021-10-19 18:00:09 +03:00
parent c5170a238f
commit b09f44f94f
4 changed files with 64 additions and 25 deletions

View file

@ -63,10 +63,13 @@ define([
this.addListeners({ this.addListeners({
'PE.Views.Animation': { 'PE.Views.Animation': {
'animation:preview': _.bind(this.onPreviewClick, this), '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:duration': _.bind(this.onDurationChange, this),
'animation:selecteffect': _.bind(this.onEffectSelect, this), 'animation:selecteffect': _.bind(this.onEffectSelect, this),
'animation:delay': _.bind(this.onDelayChange, 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': { 'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this) 'tab:active': _.bind(this.onActiveTab, this)
@ -117,35 +120,39 @@ define([
}, },
onParameterClick: function (item) { onParameterClick: function (item) {
this.EffectType = item.value; this._state.EffectType = item.value;
},
onAnimationPane: function() {
},
onAddEffect: function() {
}, },
onDurationChange: function(field, newValue, oldValue, eOpts) { onDurationChange: function(field, newValue, oldValue, eOpts) {
this._state.Duration = field.getNumberValue()*1000;
}, },
onDelayChange: function(field, newValue, oldValue, eOpts) { onDelayChange: function(field, newValue, oldValue, eOpts) {
this._state.Delay = field.getNumberValue()*1000;
}, },
onCheckDelayChange: function(field, newValue, oldValue, eOpts) {
},
onEffectSelect: function (combo, record) { onEffectSelect: function (combo, record) {
var type = record.get('value'); var type = record.get('value');
if (this.Effect !== type) { if (this._state.Effect !== type) {
var parameter = this.view.setMenuParameters(type); var parameter = this.view.setMenuParameters(type);
if (parameter) if (parameter)
this.onParameterClick(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) { if (eltype == Asc.c_oAscTypeSelectElement.Slide) {
//this.loadSettings(pr); this.loadSettings();
if (this._state.onactivetab) { if (this._state.onactivetab) {
this.setLocked(); 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) { onActiveTab: function(tab) {
@ -194,6 +218,21 @@ define([
setSettings: function () { setSettings: function () {
var me = this.view; 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 || {})); }, PE.Controllers.Animation || {}));

View file

@ -185,10 +185,10 @@
<span class="btn-slot text x-huge" id="animation-button-parameters"></span> <span class="btn-slot text x-huge" id="animation-button-parameters"></span>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>
<div class="group small"> <div class="group small" style = "min-width: 130px;">
<div class="elset font-normal"> <div class="elset font-normal">
<label id="animation-label-start"></label> <label id="animation-label-start"></label>
<span class="btn-slot" style="float: right; width: 60px; margin-left: 2px;" id="animation-start"></span> <div class="btn-slot" style="float: right; width: 76px; " id="animation-start"></div>
</div> </div>
<div class="elset"> <div class="elset">
<span class="btn-slot text " id="animation-button-pane"></span> <span class="btn-slot text " id="animation-button-pane"></span>
@ -196,17 +196,17 @@
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>
<div class="group small"> <div class="group small" style = "min-width: 122px;">
<div class="elset font-normal"> <div class="elset font-normal">
<label id="animation-delay"></label> <label id="animation-delay"></label>
<div id="animation-spin-delay" class="btn-slot text spinner" style="float: right;"></div> <span id="animation-spin-delay" class="btn-slot text spinner" style="float: right"></span>
</div> </div>
<div class="elset font-normal"> <div class="elset font-normal">
<label id="animation-duration"></label> <label id="animation-duration"></label>
<span id="animation-spin-duration" class="btn-slot text spinner" style="float: right;"></span> <span id="animation-spin-duration" class="btn-slot text spinner" style="float: right"></span>
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>
<div class="group small"> <div class="group small">
<div class="elset"> <div class="elset">

View file

@ -233,7 +233,7 @@ define([
this.numDuration = new Common.UI.MetricSpinner({ this.numDuration = new Common.UI.MetricSpinner({
el: this.$el.find('#animation-spin-duration'), el: this.$el.find('#animation-spin-duration'),
step: 1, step: 1,
width: 50, width: 52,
value: '', value: '',
defaultUnit: this.txtSec, defaultUnit: this.txtSec,
maxValue: 300, maxValue: 300,
@ -248,7 +248,7 @@ define([
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'),
step: 1, step: 1,
width: 60, width: 52,
value: '', value: '',
defaultUnit: this.txtSec, defaultUnit: this.txtSec,
maxValue: 300, maxValue: 300,

View file

@ -1,4 +1,4 @@
#transitions-panel { #transitions-panel,#animation-panel {
.item { .item {
background: transparent; background: transparent;
border-color: transparent; border-color: transparent;