Refactoring

This commit is contained in:
OVSharova 2021-12-10 21:39:27 +03:00
parent d9c9e17601
commit 517af51af2
4 changed files with 90 additions and 20 deletions

View file

@ -75,7 +75,9 @@ define([
'animation:repeat': _.bind(this.onRepeatChange, this),
'animation:additional': _.bind(this.onAnimationAdditional, this),
'animation:trigger': _.bind(this.onTriggerClick, this),
'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this)
'animation:triggerclickof': _.bind(this.onTriggerClickOfClick, this),
'animation:moveearlier': _.bind(this.onMoveEarlier, this),
'animation:movelater': _.bind(this.onMoveLater, this)
},
'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this)
@ -125,7 +127,6 @@ define([
},
onParameterClick: function (value) {
// this._state.EffectOption = value;
if(this.api && this.AnimationProperties) {
this.AnimationProperties.asc_putSubtype(value);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
@ -166,7 +167,6 @@ define([
onDurationChange: function(field, newValue, oldValue, eOpts) {
if (this.api) {
// this._state.Duration = field.getNumberValue() * 1000;
this.AnimationProperties.asc_putDuration(field.getNumberValue() * 1000);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
}
@ -174,7 +174,6 @@ define([
onDelayChange: function(field, newValue, oldValue, eOpts) {
if (this.api) {
// this._state.Delay = field.getNumberValue() * 1000;
this.AnimationProperties.asc_putDelay(field.getNumberValue() * 1000);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
}
@ -182,12 +181,19 @@ define([
onRepeatChange: function (field, newValue, oldValue, eOpts){
if (this.api) {
// this._state.Repeat = field.getNumberValue() * 1000;
this.AnimationProperties.asc_putRepeatCount(field.getNumberValue() * 1000);
this.api.asc_SetAnimationProperties(this.AnimationProperties);
}
},
onMoveEarlier: function () {
},
onMoveLater: function () {
},
onTriggerClick: function (value) {
if(this.api) {
if(value.value == this.view.triggers.ClickSequence) {

View file

@ -226,8 +226,15 @@
<span class="btn-slot text" id="animation-checkbox-rewind"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small" style="width: 120px; min-width: 100px;">
<div class="elset">
<div class="btn-slot" id="animation-moveearlier"></div>
</div>
<div class="elset font-normal">
<div class="btn-slot" id="animation-movelater"></div>
</div>
</div>
</section>
</section>
</section>

View file

@ -65,9 +65,11 @@ define([
me.fireEvent('animation:additional', [true]); // replace effect
}, me));
}
me.btnAddAnimation && me.btnAddAnimation.menu.on('item:click', function (menu, item, e) {
(item.value=='more') && me.fireEvent('animation:additional', [false]); // add effect
});
if (me.btnPreview) {
me.btnPreview.on('click', _.bind(function(btn) {
me.fireEvent('animation:preview', [me.btnPreview]);
@ -127,6 +129,14 @@ define([
}, me));
}
me.btnMoveEarlier && me.btnMoveEarlier.on('click', _.bind(function(btn) {
me.fireEvent('animation:moveearlier', [me.btnMoveEarlier]);
}, me));
me.btnMoveLater && me.btnMoveLater.on('click', _.bind(function(btn) {
me.fireEvent('animation:movelater', [me.btnMoveLater]);
}, me));
}
return {
@ -279,7 +289,7 @@ define([
value: this.triggers.ClickOf,
caption: this.textOnClickOf,
menu: new Common.UI.Menu({
menuAlign: 'tr-br',
menuAlign: 'tl-tr',
items: []
})
}]
@ -345,6 +355,32 @@ define([
});
this.lockedControls.push(this.numRepeat);
this.btnMoveEarlier = new Common.UI.Button({
parentEl: $('#animation-moveearlier'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-arrow-up',
style: 'min-width: 82px',
caption: this.textMoveEarlier,
lock: [_set.slideDeleted, _set.noSlides, _set.noGraphic, _set.noAnimation, _set.noTriggerObjects],
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.lockedControls.push(this.btnMoveEarlier);
this.btnMoveLater = new Common.UI.Button({
parentEl: $('#animation-movelater'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-arrow-down',
style: 'min-width: 82px',
caption: this.textMoveLater,
lock: [_set.slideDeleted, _set.noSlides, _set.noGraphic, _set.noAnimation, _set.noTriggerObjects],
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.lockedControls.push(this.btnMoveLater);
this.$el.find('#animation-duration').text(this.strDuration);
this.$el.find('#animation-delay').text(this.strDelay);
this.$el.find('#animation-label-start').text(this.strStart);
@ -490,7 +526,9 @@ define([
textOnClickOf: 'On Click of',
textNone: 'None',
textMultiple: 'Multiple',
textMoreEffects: 'Show More Effects'
textMoreEffects: 'Show More Effects',
textMoveEarlier: 'Move Earlier',
textMoveLater: 'Move Later'
}
}()), PE.Views.Animation || {}));

View file

@ -67,12 +67,14 @@ define([
this._state=[];
this.handler = this.options.handler;
this.EffectGroupData = Common.define.effectData.getEffectGroupData();
this._state.activeGroup = this.EffectGroupData[0].id;
this._state.activeGroupValue = this.EffectGroupData[0].value;
this.EffectGroupData.forEach(function (item) {item.displayValue = item.caption;});
if (this.options.Effect != undefined) {
this._state.activeEffect = this.options.Effect;
var itemEffect= this.allEffects.findWhere({value: this._state.activeEffect});
if (this.options.activeEffect != undefined) {
this._state.activeEffect = this.options.activeEffect;
var itemEffect = _.findWhere(this.allEffects,{value: this._state.activeEffect});
this._state.activeGroup = itemEffect.group;
this._state.activeGroupValue = this.EffectGroupData.findWhere({id: this._state.activeGroup});
this._state.activeGroupValue = _.findWhere(this.EffectGroupData, {id: this._state.activeGroup}).value;
this.activeLevel = itemEffect.level;
}
Common.UI.Window.prototype.initialize.call(this, this.options);
@ -117,25 +119,42 @@ define([
el : $('#animation-setpreview'),
labelText : this.textPreviewEffect
});
this.cmbGroup.selectRecord(this.cmbGroup.store.models[0]);
this.onGroupSelect(undefined,this.cmbGroup.store.models[0]);
this.cmbGroup.setValue(this._state.activeGroupValue);
this.fillLevel();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
onGroupSelect: function (combo, record) {
this._state.activeGroup = record.id;
this._state.activeGroupValue = record.get('value');
this.cmbLevel.store.reset(Common.define.effectData.getLevelEffect(record.id == 'menu-effect-group-path'));
this.cmbLevel.selectRecord(this.cmbLevel.store.models[0]);
this.onLevelSelect(undefined,this.cmbLevel.store.models[0]);
this._state.activeGroupValue = record.value;
this.activeLevel = undefined;
this._state.activeEffect = undefined;
this.fillLevel();
},
fillLevel: function ()
{
this.cmbLevel.store.reset(Common.define.effectData.getLevelEffect(this._state.activeGroup == 'menu-effect-group-path'));
var item = (this.activeLevel)?this.cmbLevel.store.findWhere({id: this.activeLevel}):this.cmbLevel.store.at(0);
this.cmbLevel.setValue(item.get('displayValue'));
this.activeLevel = item.get('id');
this.fillEffect();
},
onLevelSelect: function (combo, record) {
this.activeLevel = record.id;
this._state.activeEffect = undefined;
this.fillEffect();
},
fillEffect: function () {
var arr = _.where(this.allEffects, {group: this._state.activeGroup, level: this.activeLevel });
this.lstEffectList.store.reset(arr);
this.lstEffectList.selectRecord(this.lstEffectList.store.models[0]);
var item = (this._state.activeEffect)?this.lstEffectList.store.findWhere({value: this._state.activeEffect}):this.lstEffectList.store.at(0);
this.lstEffectList.selectRecord(item);
this._state.activeEffect = item.get('value');
},
onEffectListItem: function (lisvView, itemView, record){