Refactoring
This commit is contained in:
parent
d9c9e17601
commit
517af51af2
|
@ -75,7 +75,9 @@ define([
|
||||||
'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),
|
||||||
|
'animation:moveearlier': _.bind(this.onMoveEarlier, this),
|
||||||
|
'animation:movelater': _.bind(this.onMoveLater, this)
|
||||||
},
|
},
|
||||||
'Toolbar': {
|
'Toolbar': {
|
||||||
'tab:active': _.bind(this.onActiveTab, this)
|
'tab:active': _.bind(this.onActiveTab, this)
|
||||||
|
@ -125,7 +127,6 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onParameterClick: function (value) {
|
onParameterClick: function (value) {
|
||||||
// this._state.EffectOption = value;
|
|
||||||
if(this.api && this.AnimationProperties) {
|
if(this.api && this.AnimationProperties) {
|
||||||
this.AnimationProperties.asc_putSubtype(value);
|
this.AnimationProperties.asc_putSubtype(value);
|
||||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||||
|
@ -166,7 +167,6 @@ define([
|
||||||
|
|
||||||
onDurationChange: function(field, newValue, oldValue, eOpts) {
|
onDurationChange: function(field, newValue, oldValue, eOpts) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
// this._state.Duration = field.getNumberValue() * 1000;
|
|
||||||
this.AnimationProperties.asc_putDuration(field.getNumberValue() * 1000);
|
this.AnimationProperties.asc_putDuration(field.getNumberValue() * 1000);
|
||||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,6 @@ define([
|
||||||
|
|
||||||
onDelayChange: function(field, newValue, oldValue, eOpts) {
|
onDelayChange: function(field, newValue, oldValue, eOpts) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
// this._state.Delay = field.getNumberValue() * 1000;
|
|
||||||
this.AnimationProperties.asc_putDelay(field.getNumberValue() * 1000);
|
this.AnimationProperties.asc_putDelay(field.getNumberValue() * 1000);
|
||||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||||
}
|
}
|
||||||
|
@ -182,12 +181,19 @@ define([
|
||||||
|
|
||||||
onRepeatChange: function (field, newValue, oldValue, eOpts){
|
onRepeatChange: function (field, newValue, oldValue, eOpts){
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
// this._state.Repeat = field.getNumberValue() * 1000;
|
|
||||||
this.AnimationProperties.asc_putRepeatCount(field.getNumberValue() * 1000);
|
this.AnimationProperties.asc_putRepeatCount(field.getNumberValue() * 1000);
|
||||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onMoveEarlier: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onMoveLater: function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
onTriggerClick: function (value) {
|
onTriggerClick: function (value) {
|
||||||
if(this.api) {
|
if(this.api) {
|
||||||
if(value.value == this.view.triggers.ClickSequence) {
|
if(value.value == this.view.triggers.ClickSequence) {
|
||||||
|
|
|
@ -226,8 +226,15 @@
|
||||||
<span class="btn-slot text" id="animation-checkbox-rewind"></span>
|
<span class="btn-slot text" id="animation-checkbox-rewind"></span>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -65,9 +65,11 @@ define([
|
||||||
me.fireEvent('animation:additional', [true]); // replace effect
|
me.fireEvent('animation:additional', [true]); // replace effect
|
||||||
}, me));
|
}, me));
|
||||||
}
|
}
|
||||||
|
|
||||||
me.btnAddAnimation && me.btnAddAnimation.menu.on('item:click', function (menu, item, e) {
|
me.btnAddAnimation && me.btnAddAnimation.menu.on('item:click', function (menu, item, e) {
|
||||||
(item.value=='more') && me.fireEvent('animation:additional', [false]); // add effect
|
(item.value=='more') && me.fireEvent('animation:additional', [false]); // add effect
|
||||||
});
|
});
|
||||||
|
|
||||||
if (me.btnPreview) {
|
if (me.btnPreview) {
|
||||||
me.btnPreview.on('click', _.bind(function(btn) {
|
me.btnPreview.on('click', _.bind(function(btn) {
|
||||||
me.fireEvent('animation:preview', [me.btnPreview]);
|
me.fireEvent('animation:preview', [me.btnPreview]);
|
||||||
|
@ -127,6 +129,14 @@ define([
|
||||||
}, me));
|
}, 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 {
|
return {
|
||||||
|
@ -279,7 +289,7 @@ define([
|
||||||
value: this.triggers.ClickOf,
|
value: this.triggers.ClickOf,
|
||||||
caption: this.textOnClickOf,
|
caption: this.textOnClickOf,
|
||||||
menu: new Common.UI.Menu({
|
menu: new Common.UI.Menu({
|
||||||
menuAlign: 'tr-br',
|
menuAlign: 'tl-tr',
|
||||||
items: []
|
items: []
|
||||||
})
|
})
|
||||||
}]
|
}]
|
||||||
|
@ -345,6 +355,32 @@ define([
|
||||||
});
|
});
|
||||||
this.lockedControls.push(this.numRepeat);
|
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-duration').text(this.strDuration);
|
||||||
this.$el.find('#animation-delay').text(this.strDelay);
|
this.$el.find('#animation-delay').text(this.strDelay);
|
||||||
this.$el.find('#animation-label-start').text(this.strStart);
|
this.$el.find('#animation-label-start').text(this.strStart);
|
||||||
|
@ -490,7 +526,9 @@ define([
|
||||||
textOnClickOf: 'On Click of',
|
textOnClickOf: 'On Click of',
|
||||||
textNone: 'None',
|
textNone: 'None',
|
||||||
textMultiple: 'Multiple',
|
textMultiple: 'Multiple',
|
||||||
textMoreEffects: 'Show More Effects'
|
textMoreEffects: 'Show More Effects',
|
||||||
|
textMoveEarlier: 'Move Earlier',
|
||||||
|
textMoveLater: 'Move Later'
|
||||||
}
|
}
|
||||||
}()), PE.Views.Animation || {}));
|
}()), PE.Views.Animation || {}));
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,14 @@ define([
|
||||||
this._state=[];
|
this._state=[];
|
||||||
this.handler = this.options.handler;
|
this.handler = this.options.handler;
|
||||||
this.EffectGroupData = Common.define.effectData.getEffectGroupData();
|
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;});
|
this.EffectGroupData.forEach(function (item) {item.displayValue = item.caption;});
|
||||||
if (this.options.Effect != undefined) {
|
if (this.options.activeEffect != undefined) {
|
||||||
this._state.activeEffect = this.options.Effect;
|
this._state.activeEffect = this.options.activeEffect;
|
||||||
var itemEffect= this.allEffects.findWhere({value: this._state.activeEffect});
|
var itemEffect = _.findWhere(this.allEffects,{value: this._state.activeEffect});
|
||||||
this._state.activeGroup = itemEffect.group;
|
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;
|
this.activeLevel = itemEffect.level;
|
||||||
}
|
}
|
||||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||||
|
@ -117,25 +119,42 @@ define([
|
||||||
el : $('#animation-setpreview'),
|
el : $('#animation-setpreview'),
|
||||||
labelText : this.textPreviewEffect
|
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));
|
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
},
|
},
|
||||||
|
|
||||||
onGroupSelect: function (combo, record) {
|
onGroupSelect: function (combo, record) {
|
||||||
this._state.activeGroup = record.id;
|
this._state.activeGroup = record.id;
|
||||||
this._state.activeGroupValue = record.get('value');
|
this._state.activeGroupValue = record.value;
|
||||||
this.cmbLevel.store.reset(Common.define.effectData.getLevelEffect(record.id == 'menu-effect-group-path'));
|
this.activeLevel = undefined;
|
||||||
this.cmbLevel.selectRecord(this.cmbLevel.store.models[0]);
|
this._state.activeEffect = undefined;
|
||||||
this.onLevelSelect(undefined,this.cmbLevel.store.models[0]);
|
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) {
|
onLevelSelect: function (combo, record) {
|
||||||
this.activeLevel = record.id;
|
this.activeLevel = record.id;
|
||||||
|
this._state.activeEffect = undefined;
|
||||||
|
this.fillEffect();
|
||||||
|
},
|
||||||
|
|
||||||
|
fillEffect: function () {
|
||||||
var arr = _.where(this.allEffects, {group: this._state.activeGroup, level: this.activeLevel });
|
var arr = _.where(this.allEffects, {group: this._state.activeGroup, level: this.activeLevel });
|
||||||
this.lstEffectList.store.reset(arr);
|
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){
|
onEffectListItem: function (lisvView, itemView, record){
|
||||||
|
|
Loading…
Reference in a new issue