Add actions
This commit is contained in:
parent
641b860bde
commit
ee55ea6bd9
|
@ -70,6 +70,7 @@ define([
|
|||
'animation:animationpane':_.bind(this.onAnimationPane, this),
|
||||
'animation:addanimation': _.bind(this.onAddAnimation, this),
|
||||
'animation:startselect': _.bind(this.onStartSelect, this),
|
||||
'animation:checkrewind': _.bind(this.onCheckRewindChange,this),
|
||||
},
|
||||
'Toolbar': {
|
||||
'tab:active': _.bind(this.onActiveTab, this)
|
||||
|
@ -84,7 +85,6 @@ define([
|
|||
|
||||
setConfig: function (config) {
|
||||
this.appConfig = config.mode;
|
||||
|
||||
this.view = this.createView('PE.Views.Animation', {
|
||||
toolbar: config.toolbar,
|
||||
mode: config.mode
|
||||
|
@ -121,64 +121,90 @@ define([
|
|||
|
||||
onParameterClick: function (value) {
|
||||
this._state.EffectOption = value;
|
||||
if(this.api && this.AnimationProperties) {
|
||||
this.AnimationProperties.asc_putSubtype(value);
|
||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||
this.getAnimationProperties();
|
||||
|
||||
console.log(this.AnimationProperties.asc_getSubtype());
|
||||
}
|
||||
},
|
||||
|
||||
onAnimationPane: function() {
|
||||
onAnimationPane: function(combo, record) {
|
||||
|
||||
},
|
||||
|
||||
onAddAnimation: function() {
|
||||
|
||||
var type = record.get('value');
|
||||
var parameter;
|
||||
var group = Common.define.effectData.getEffectGroupData().findWhere({id: record.group}).value;
|
||||
if (this._state.Effect !== type) {
|
||||
parameter= this.view.setMenuParameters(type, undefined, group == this._state.EffectGroups);
|
||||
this.api.asc_AddAnimation(this._state.EffectGroups, type, parameter);
|
||||
if (parameter!= undefined)
|
||||
this.onParameterClick(parameter);
|
||||
}
|
||||
this._state.EffectGroups = group;
|
||||
this._state.Effect = type;
|
||||
},
|
||||
|
||||
onDurationChange: function(field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this._state.Duration = field.getNumberValue() * 1000;
|
||||
this.AnimationProperties.asc_putDuration(this._state.Duration);
|
||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||
}
|
||||
},
|
||||
|
||||
onDelayChange: function(field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this._state.Delay = field.getNumberValue() * 1000;
|
||||
this.AnimationProperties.asc_putDelay(this._state.Delay);
|
||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||
}
|
||||
},
|
||||
|
||||
onEffectSelect: function (combo, record) {
|
||||
var type = record.get('value');
|
||||
var parameter = this._state.EffectOption;
|
||||
|
||||
if (this.Effect !== type) {
|
||||
parameter = this.view.setMenuParameters(type, parameter, true);
|
||||
if (type != -10 && this.Effect == -10)
|
||||
this.api.asc_AddAnimation(this.EffectGroups.findWhere({id: record.group}).value, type);
|
||||
else
|
||||
{
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
for (var i = 0; i < selectedElements.length; i0) {
|
||||
var elType = selectedElements[i].get_ObjectType();
|
||||
if(elType==Asc.c_oAscTypeSelectElement.Animation)
|
||||
{
|
||||
//selectedElements[i].
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._state.Effect = type;
|
||||
var parameter;
|
||||
var group = _.findWhere(Common.define.effectData.getEffectGroupData(),{id: record.get('group')}).value;
|
||||
if (this._state.Effect !== type) {
|
||||
parameter= this.view.setMenuParameters(type, undefined, group != this._state.EffectGroups);
|
||||
this.api.asc_AddAnimation(group, type, parameter);
|
||||
if (parameter!= undefined) {
|
||||
this.onParameterClick(parameter);
|
||||
}
|
||||
//else this.api.asc_AddAnimation(group, type,-1);
|
||||
}
|
||||
this._state.EffectGroups = group;
|
||||
this._state.Effect = type;
|
||||
},
|
||||
|
||||
onStartSelect: function (combo, record) {
|
||||
if (this.api) {
|
||||
this._state.StartEffect =record.value;
|
||||
this.AnimationProperties.asc_putStartType(this._state.StartEffect);
|
||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||
}
|
||||
},
|
||||
|
||||
onCheckRewindChange: function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api && this.AnimationProperties) {
|
||||
this.AnimationProperties.asc_putRewind(field.getValue() == 'checked');
|
||||
this.api.asc_SetAnimationProperties(this.AnimationProperties);
|
||||
}
|
||||
},
|
||||
|
||||
onFocusObject: function(selectedObjects) {
|
||||
var me = this;
|
||||
for (var i = 0; i<selectedObjects.length; i++) {
|
||||
var eltype = selectedObjects[i].get_ObjectType();
|
||||
|
||||
if (eltype === undefined)
|
||||
continue;
|
||||
|
||||
if (eltype == Asc.c_oAscTypeSelectElement.Slide) {
|
||||
|
||||
this.loadSettings();
|
||||
|
||||
if (eltype == Asc.c_oAscTypeSelectElement.Animation) {
|
||||
this.AnimationProperties = selectedObjects[i].get_ObjectValue();
|
||||
this.loadSettings(this.AnimationProperties);
|
||||
if (this._state.onactivetab) {
|
||||
this.setLocked();
|
||||
this.setSettings();
|
||||
|
@ -187,28 +213,43 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
loadSettings: function () {
|
||||
getAnimationProperties: function() {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
for (var i = 0; i<selectedElements.length; i++) {
|
||||
if (selectedElements[i].get_ObjectType() === Asc.c_oAscTypeSelectElement.Animation) {
|
||||
this.AnimationProperties = selectedElements[i].get_ObjectValue();
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
||||
/* var oPr= Asc.c_oAscTypeSelectElement.Animation;
|
||||
this._state.Effect = oPr.asc_getClass();*/
|
||||
this._state.Effect = !this._state.Effect ? -10 : this._state.Effect;
|
||||
this._state.EffectOption = !this._state.EffectOption ? this.view.setMenuParameters(this._state.Effect,undefined,true): this._state.EffectOption;
|
||||
loadSettings: function (props) {
|
||||
this.AnimationProperties = props;
|
||||
var value;
|
||||
this._state.EffectGroup = this.AnimationProperties.asc_getClass();
|
||||
value = this.AnimationProperties.asc_getType();
|
||||
value = !value ? -10 : value;
|
||||
this._state.EffectOption = this.AnimationProperties.asc_getSubtype();
|
||||
this.view.setMenuParameters(value,this._state.EffectOption,true);
|
||||
this._state.Effect = value;
|
||||
|
||||
var value = 1000;
|
||||
value = this.AnimationProperties.asc_getDuration();
|
||||
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;
|
||||
value = this.AnimationProperties.asc_getDelay();
|
||||
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;
|
||||
this._state.StartSelect = this.AnimationProperties.asc_getStartType();
|
||||
this._state.RepeatCount = this.AnimationProperties.asc_getRepeatCount();
|
||||
this._state.Rewind = this.AnimationProperties.asc_getRewind();
|
||||
},
|
||||
|
||||
onActiveTab: function(tab) {
|
||||
|
@ -239,17 +280,15 @@ define([
|
|||
}
|
||||
|
||||
if (me.btnParameters.menu.items.length > 0 && this._state.EffectOption !== undefined)
|
||||
me.setMenuParameters(this._state.Effect, this._state.EffectOption);
|
||||
me.setMenuParameters(this._state.Effect, this._state.EffectOption, true);
|
||||
|
||||
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);
|
||||
|
||||
(this._state.StartSelect==undefined)&&(this._state.StartSelect = AscFormat.NODE_TYPE_CLICKEFFECT);
|
||||
item = me.cmbStart.store.findWhere({value: this._state.StartSelect});
|
||||
me.cmbStart.selectRecord(item ? item : me.cmbStart.items[0]);
|
||||
|
||||
|
||||
//this.view.setWidthRow();
|
||||
|
||||
|
||||
me.cmbStart.selectRecord(item);
|
||||
me.chRewind.setValue(this._state.Rewind);
|
||||
}
|
||||
|
||||
}, PE.Controllers.Animation || {}));
|
||||
|
|
|
@ -111,6 +111,12 @@ define([
|
|||
}, me);
|
||||
}
|
||||
|
||||
if (me.chRewind) {
|
||||
me.chRewind.on('change', _.bind(function (e) {
|
||||
me.fireEvent('animation:checkrewind', [me.chRewind, me.chRewind.value, me.chRewind.lastValue]);
|
||||
}, me));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -270,9 +276,9 @@ define([
|
|||
menuStyle: 'width: 150px;',
|
||||
//lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock],
|
||||
data: [
|
||||
{value: 0, displayValue: this.textStartOnClick},
|
||||
{value: 1, displayValue: this.textStartBeforePrevious},
|
||||
{value: 2, displayValue: this.textStartAfterPrevious}
|
||||
{value: AscFormat.NODE_TYPE_CLICKEFFECT, displayValue: this.textStartOnClick},
|
||||
{value: AscFormat.NODE_TYPE_WITHEFFECT, displayValue: this.textStartWithPrevious},
|
||||
{value: AscFormat.NODE_TYPE_AFTEREFFECT, displayValue: this.textStartAfterPrevious}
|
||||
],
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'top'
|
||||
|
@ -444,12 +450,16 @@ define([
|
|||
|
||||
var selectedElement;
|
||||
this.btnParameters.menu.removeAll();
|
||||
//if(this._arrEffectOptions[effect.value].length>0) {
|
||||
if(this._arrEffectOptions[effect.value]) {
|
||||
this._arrEffectOptions[effect.value].forEach(function (opt) {
|
||||
var i=0;
|
||||
this._arrEffectOptions[effect.value].forEach(function (opt, index) {
|
||||
this.btnParameters.menu.addItem(opt);
|
||||
this.btnParameters.menu.items[index].checkable=true;
|
||||
if((option!=undefined)&&(opt.value==option))
|
||||
i = index;
|
||||
}, this);
|
||||
selectedElement = this.btnParameters.menu.items[0];
|
||||
selectedElement = this.btnParameters.menu.items[i];
|
||||
selectedElement.setChecked(true);
|
||||
}
|
||||
else {
|
||||
selectedElement = undefined;
|
||||
|
@ -459,7 +469,7 @@ define([
|
|||
this.btnParameters.setDisabled(!selectedElement);
|
||||
}
|
||||
|
||||
return (selectedElement)?selectedElement.value:-1;
|
||||
return (selectedElement)?selectedElement.value:undefined;
|
||||
},
|
||||
|
||||
|
||||
|
@ -476,7 +486,7 @@ define([
|
|||
strTrigger: 'Trigger',
|
||||
|
||||
textStartOnClick: 'On Click',
|
||||
textStartBeforePrevious: 'Before Previous',
|
||||
textStartWithPrevious: 'With Previous',
|
||||
textStartAfterPrevious: 'After Previous',
|
||||
|
||||
textNone: 'None',
|
||||
|
|
Loading…
Reference in a new issue