Add actions for cmbRepeat

This commit is contained in:
OVSharova 2022-01-13 05:33:27 +03:00
parent eaab1e2fa3
commit 078c7123dd
2 changed files with 37 additions and 8 deletions

View file

@ -72,7 +72,7 @@ define([
'animation:addanimation': _.bind(this.onAddAnimation, this), 'animation:addanimation': _.bind(this.onAddAnimation, this),
'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:trigger': _.bind(this.onTriggerClick, this),
'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this), 'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this),
@ -80,7 +80,10 @@ define([
'animation:movelater': _.bind(this.onMoveLater, this), 'animation:movelater': _.bind(this.onMoveLater, this),
'animation:repeatchangebefore': _.bind(this.onRepeatChange, this), 'animation:repeatchangebefore': _.bind(this.onRepeatChange, this),
'animation:repeatchangeafter': _.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) 'animation:repeatselected': _.bind(this.onRepeatSelected, this)
}, },
'Toolbar': { 'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this) 'tab:active': _.bind(this.onActiveTab, this)
@ -205,9 +208,35 @@ define([
me = this; me = this;
if(before) 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 { } 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); view.numDelay.setValue((this._state.Delay !== null && this._state.Delay !== undefined) ? this._state.Delay / 1000. : '', true);
} }
this._state.Repeat = this.AnimationProperties.asc_getRepeatCount(); 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(); this._state.StartSelect = this.AnimationProperties.asc_getStartType();
view.cmbStart.setValue(this._state.StartSelect!==undefined ? this._state.StartSelect : AscFormat.NODE_TYPE_CLICKEFFECT); view.cmbStart.setValue(this._state.StartSelect!==undefined ? this._state.StartSelect : AscFormat.NODE_TYPE_CLICKEFFECT);

View file

@ -118,20 +118,20 @@ define([
} }
if (me.cmbRepeat) { 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.fireEvent('animation:repeatchangebefore', [true, combo, record]);
}, me); }, 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.fireEvent('animation:repeatchangeafter', [false, combo, record]);
}, me); }, me);
me.cmbRepeat.on('selected', function (combo, record) { me.cmbRepeat.on('selected', function (combo, record) {
me.fireEvent('animation:repeatselected', [combo, record]); me.fireEvent('animation:repeatselected', [combo, record]);
}, me); }, me);
me.cmbRepeat.on('show:after', function (needfocus, combo) { me.cmbRepeat.on('show:after', function (combo) {
me.fireEvent('animation:repeatopen', [needfocus, combo]); me.fireEvent('animation:repeatshow', [true, combo]);
}, me); }, me);
me.cmbRepeat.on('combo:focusin', function (needfocus, combo) { me.cmbRepeat.on('combo:focusin', function (combo) {
me.fireEvent('animation:repeatopen', [needfocus, combo]); me.fireEvent('animation:repeatfocusin', [false, combo]);
}, me); }, me);
} }