From 078c7123dd6cc4d25c99896a1ecf5ea8bd45caba Mon Sep 17 00:00:00 2001 From: OVSharova Date: Thu, 13 Jan 2022 05:33:27 +0300 Subject: [PATCH] Add actions for cmbRepeat --- .../main/app/controller/Animation.js | 33 +++++++++++++++++-- .../main/app/view/Animation.js | 12 +++---- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index 1754ff442..07e94d2bd 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -72,7 +72,7 @@ define([ 'animation:addanimation': _.bind(this.onAddAnimation, this), 'animation:startselect': _.bind(this.onStartSelect, 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:trigger': _.bind(this.onTriggerClick, this), 'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this), @@ -80,7 +80,10 @@ define([ 'animation:movelater': _.bind(this.onMoveLater, this), 'animation:repeatchangebefore': _.bind(this.onRepeatChange, this), 'animation:repeatchangeafter': _.bind(this.onRepeatChange, this), + 'animation:repeatshow': _.bind(this.onRepeatComboOpen, this), + 'animation:repeatfocusin': _.bind(this.onRepeatComboOpen, this), 'animation:repeatselected': _.bind(this.onRepeatSelected, this) + }, 'Toolbar': { 'tab:active': _.bind(this.onActiveTab, this) @@ -205,9 +208,35 @@ define([ me = this; if(before) { + var item = combo.store.findWhere({ + displayValue: record.value + }); + + if (!item) { + value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value); + + if (!value) { + value = this._state.Repeat; + combo.setRawValue(value); + if(!_.isNumber(record.value)) + record.value = value; + + return false; + } + } } else { + value = Common.Utils.String.parseFloat(record.value); + if(!record.displayValue) + value = value > 9999 ? 9999 : + value < 1 ? 1 : Math.floor((value+0.4)*2)/2; + combo.setValue(value); + + if (this.api) { + this.AnimationProperties.asc_putRepeatCount(value); + this.api.asc_SetAnimationProperties(this.AnimationProperties); + } } }, @@ -383,7 +412,7 @@ define([ view.numDelay.setValue((this._state.Delay !== null && this._state.Delay !== undefined) ? this._state.Delay / 1000. : '', true); } this._state.Repeat = this.AnimationProperties.asc_getRepeatCount(); - view.cmbRepeat.setValue((this._state.Repeat !== null && this._state.Repeat !== undefined) ? this._state.Repeat/1000. : 1); + view.cmbRepeat.setValue( this._state.Repeat !== undefined ? this._state.Repeat : 1); this._state.StartSelect = this.AnimationProperties.asc_getStartType(); view.cmbStart.setValue(this._state.StartSelect!==undefined ? this._state.StartSelect : AscFormat.NODE_TYPE_CLICKEFFECT); diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 1dceb8b58..1dc9bf6e1 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -118,20 +118,20 @@ define([ } if (me.cmbRepeat) { - me.cmbRepeat.on('change:before', function (combo, record) { + me.cmbRepeat.on('changed:before', function (combo, record) { me.fireEvent('animation:repeatchangebefore', [true, combo, record]); }, me); - me.cmbRepeat.on('change:after', function (combo, record) { + me.cmbRepeat.on('changed:after', function (combo, record) { me.fireEvent('animation:repeatchangeafter', [false, combo, record]); }, me); me.cmbRepeat.on('selected', function (combo, record) { me.fireEvent('animation:repeatselected', [combo, record]); }, me); - me.cmbRepeat.on('show:after', function (needfocus, combo) { - me.fireEvent('animation:repeatopen', [needfocus, combo]); + me.cmbRepeat.on('show:after', function (combo) { + me.fireEvent('animation:repeatshow', [true, combo]); }, me); - me.cmbRepeat.on('combo:focusin', function (needfocus, combo) { - me.fireEvent('animation:repeatopen', [needfocus, combo]); + me.cmbRepeat.on('combo:focusin', function (combo) { + me.fireEvent('animation:repeatfocusin', [false, combo]); }, me); }