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