All actions

This commit is contained in:
OVSharova 2021-07-25 23:12:20 +03:00
parent ce7962016b
commit 85aaf2a98e
2 changed files with 78 additions and 116 deletions

View file

@ -69,15 +69,14 @@ define([
'transit:duration': _.bind(this.onDurationChange,this), 'transit:duration': _.bind(this.onDurationChange,this),
'transit:applytoall': _.bind(this.onApplyToAllClick,this), 'transit:applytoall': _.bind(this.onApplyToAllClick,this),
'transit:selecteffect': _.bind(this.onEffectSelect, this), 'transit:selecteffect': _.bind(this.onEffectSelect, this),
'transit:slidenum': _.bind(this.onHeaderChange,this) 'transit:startonclick': _.bind(this.onStartOnClickChange,this),
'transit:delay': _.bind(this.onDelayChange,this)
} }
}); });
}, },
onLaunch: function () { onLaunch: function () {
this._state = {}; this._state = {};
//this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/};
//Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); //Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
}, },
setConfig: function (data, api) { setConfig: function (data, api) {
@ -92,14 +91,12 @@ define([
}, },
setApi: function (api) { setApi: function (api) {
this.api = api; this.api = api;
}, },
setMode: function(mode) { setMode: function(mode) {
this.appConfig = mode; this.appConfig = mode;
this.view = this.createView('PE.Views.Transitions', { mode: mode }); this.view = this.createView('PE.Views.Transitions', { mode: mode });
return this;
return this;
}, },
loadDocument: function(data) { loadDocument: function(data) {
@ -154,13 +151,35 @@ define([
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
onHeaderChange: function(type, field, newValue, oldValue, eOpts){ onStartOnClickChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = this.api.asc_getHeaderFooterProperties(); var props = new Asc.CAscSlideProps();
props.get_Slide()[(type=='slidenum') ? 'put_ShowSlideNum' : 'put_ShowDateTime'](field.getValue()=='checked'); var transition = new Asc.CAscSlideTransition();
this.api.asc_setHeaderFooterProperties(props); transition.put_SlideAdvanceOnMouseClick(field.getValue()=='checked');
props.put_transition(transition);
this.api.SetSlideProps(props);
}
},
onDelayChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition();
transition.put_SlideAdvanceDuration(field.getNumberValue()*1000);
props.put_transition(transition);
this.api.SetSlideProps(props);
this.onCheckDelayChange(field);
}
},
onCheckDelayChange: function(field, newValue, oldValue, eOpts){
//this.numDelay.setDisabled(field.getValue()!=='checked');
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition();
//transition.put_SlideAdvanceAfter(field.getValue()=='checked');
transition.put_SlideAdvanceAfter(field.getNumberValue()!=0);
props.put_transition(transition);
this.api.SetSlideProps(props);
} }
this.fireEvent('editcomplete', this);
}, },
onApplyToAllClick: function (){ onApplyToAllClick: function (){
if (this.api) this.api.SlideTransitionApplyToAll(); if (this.api) this.api.SlideTransitionApplyToAll();
@ -170,7 +189,11 @@ define([
if (this.Effect !== type && if (this.Effect !== type &&
!((this.Effect===Asc.c_oAscSlideTransitionTypes.Wipe || this.Effect===Asc.c_oAscSlideTransitionTypes.UnCover || this.Effect===Asc.c_oAscSlideTransitionTypes.Cover)&& !((this.Effect===Asc.c_oAscSlideTransitionTypes.Wipe || this.Effect===Asc.c_oAscSlideTransitionTypes.UnCover || this.Effect===Asc.c_oAscSlideTransitionTypes.Cover)&&
(type===Asc.c_oAscSlideTransitionTypes.Wipe || type===Asc.c_oAscSlideTransitionTypes.UnCover || type===Asc.c_oAscSlideTransitionTypes.Cover)) ) (type===Asc.c_oAscSlideTransitionTypes.Wipe || type===Asc.c_oAscSlideTransitionTypes.UnCover || type===Asc.c_oAscSlideTransitionTypes.Cover)) )
this.view.setMenuParametrs(type); {
var parametr=this.view.setMenuParametrs(type);
if(parametr)
this.onParametrClick(parametr);
}
this.Effect = type; this.Effect = type;
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
@ -188,6 +211,7 @@ define([
changeSettings:function (props){ changeSettings:function (props){
var me=this.view; var me=this.view;
var transition = props.get_transition(); var transition = props.get_transition();
if (transition) { if (transition) {
var value = transition.get_TransitionType(); var value = transition.get_TransitionType();
@ -196,29 +220,18 @@ define([
var item = me.listEffects.store.findWhere({value: value}); var item = me.listEffects.store.findWhere({value: value});
if (item) { if (item) {
found = true; found = true;
me.listEffects.onMenuPickerSelect(me.listEffects.menuPicker, item, item);
me.listEffects.menuPicker.selectRecord(item); me.listEffects.menuPicker.selectRecord(item);
this._state.Effect = value;
} else } else
me.listEffects.menuPicker.selectRecord(me.listEffects.menuPicker.items[0]); me.listEffects.menuPicker.selectRecord(me.listEffects.menuPicker.items[0]);
} }
value = transition.get_TransitionOption(); if (me.btnParametrs.menu) {
if (this._state.EffectType !== value || found) { value = transition.get_TransitionOption();
found = false; if (this._state.EffectType !== value) {
var item=0; me.setMenuParametrs(this._state.Effect, value);
/*_.each(me.btnParametrs.menu.items,function (element,index){ this._state.EffectType = value;
if(element.value==value) }
item= index;
});*/
//var item = me.btnParametrs.menu.items.findWhere({value: value});
if (item) {
found = true;
me.btnParametrs.menu.setChecked(0,true);
}/* else
me.cmbEffectType.menu.setValue('');*/
this._state.EffectType = value;
} }
value = transition.get_TransitionDuration(); value = transition.get_TransitionDuration();
@ -228,6 +241,7 @@ define([
me.numDuration.setValue((value !== null && value !== undefined) ? value / 1000. : '', true); me.numDuration.setValue((value !== null && value !== undefined) ? value / 1000. : '', true);
this._state.Duration = value; this._state.Duration = value;
} }
value = transition.get_SlideAdvanceDuration(); value = transition.get_SlideAdvanceDuration();
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) ||
@ -235,78 +249,19 @@ define([
me.numDelay.setValue((value !== null && value !== undefined) ? value / 1000. : '', true); me.numDelay.setValue((value !== null && value !== undefined) ? value / 1000. : '', true);
this._state.Delay = value; this._state.Delay = value;
} }
/*value = transition.get_SlideAdvanceOnMouseClick();
if ( this._state.OnMouseClick!==value ) {
me.chStartOnClick.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this._state.OnMouseClick=value;
}*/
/*value = transition.get_SlideAdvanceAfter();
if ( this._state.AdvanceAfter!==value ) {
this.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this.numDelay.setDisabled(this.chDelay.getValue()!=='checked');
this._state.AdvanceAfter=value;
}*/
}
/*if (transition) {
var value = transition.get_TransitionType();
var found = false;
if (this._state.Effect !== value) {
var item = this.cmbEffectName.store.findWhere({value: value});
if (item) {
found = true;
this.cmbEffectName.setValue(item.get('value'));
} else
this.cmbEffectName.setValue('');
this.fillEffectTypeCombo((found) ? value : undefined);
this.Effect = value;
this._state.Effect = value;
}
value = transition.get_TransitionOption();
if (this._state.EffectType !== value || found) {
found = false;
item = this.cmbEffectType.store.findWhere({value: value});
if (item) {
found = true;
this.cmbEffectType.setValue(item.get('value'));
} else
this.cmbEffectType.setValue('');
this._state.EffectType = value;
}
value = transition.get_TransitionDuration();
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.numDuration.setValue((value !== null && value !== undefined) ? value/1000. : '', true);
this._state.Duration=value;
}
value = transition.get_SlideAdvanceDuration();
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.numDelay.setValue((value !== null && value !== undefined) ? value/1000. : '', true);
this._state.Delay=value;
}
value = transition.get_SlideAdvanceOnMouseClick(); value = transition.get_SlideAdvanceOnMouseClick();
if ( this._state.OnMouseClick!==value ) { if (this._state.OnMouseClick !== value) {
this.chStartOnClick.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); me.chStartOnClick.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this._state.OnMouseClick=value; this._state.OnMouseClick = value;
} }
value = transition.get_SlideAdvanceAfter(); value = transition.get_SlideAdvanceAfter();
if ( this._state.AdvanceAfter!==value ) { if (this._state.AdvanceAfter !== value) {
this.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); //me.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this.numDelay.setDisabled(this.chDelay.getValue()!=='checked'); //me.numDelay.setDisabled(this.chDelay.getValue() !== 'checked');
this._state.AdvanceAfter=value; this._state.AdvanceAfter = value;
} }
}*/ }
} }
}, PE.Controllers.Transitions || {})); }, PE.Controllers.Transitions || {}));
}); });

View file

@ -106,7 +106,6 @@ define([
{ {
me.btnPreview.on('click', _.bind(function(btn){ me.btnPreview.on('click', _.bind(function(btn){
me.fireEvent('transit:preview', [me.btnPreview]); me.fireEvent('transit:preview', [me.btnPreview]);
me.fireEvent('editcomplete', this);
}, me)); }, me));
} }
if (me.btnParametrs) { if (me.btnParametrs) {
@ -117,7 +116,6 @@ define([
me.btnParametrs.menu.on('item:click', function (menu, item, e) { me.btnParametrs.menu.on('item:click', function (menu, item, e) {
me.fireEvent('transit:parametrs', [item]); me.fireEvent('transit:parametrs', [item]);
me.fireEvent('editcomplete', this);
}); });
} }
@ -125,26 +123,22 @@ define([
{ {
me.btnApplyToAll.on('click', _.bind(function(btn){ me.btnApplyToAll.on('click', _.bind(function(btn){
me.fireEvent('transit:applytoall', [me.btnApplyToAll]); me.fireEvent('transit:applytoall', [me.btnApplyToAll]);
me.fireEvent('editcomplete', this);
}, me)); }, me));
} }
if(me.numDuration){ if(me.numDuration){
me.numDuration.on('change', function(bth) { me.numDuration.on('change', function(bth) {
me.fireEvent('transit:duration', [me.numDuration]); me.fireEvent('transit:duration', [me.numDuration]);
me.fireEvent('editcomplete', this);
},me); },me);
} }
if(me.numDelay){ if(me.numDelay){
me.numDelay.on('change', function(bth) { me.numDelay.on('change', function(bth) {
me.fireEvent('transit:delay', [me.numDelay]); me.fireEvent('transit:delay', [me.numDelay]);
me.fireEvent('editcomplete', this);
},me); },me);
} }
if(me.chStartOnClick) if(me.chStartOnClick)
{ {
me.chStartOnClick.on('change',_.bind(function (e){ me.chStartOnClick.on('change',_.bind(function (e){
me.fireEvent('transit:slidenum',['slidenum', me.chStartOnClick,me.chStartOnClick.value, me.chStartOnClick.lastValue]) me.fireEvent('transit:startonclick',[ me.chStartOnClick,me.chStartOnClick.value, me.chStartOnClick.lastValue]);
me.fireEvent('editcomplete', this);
},me)); },me));
} }
} }
@ -302,7 +296,7 @@ define([
}); });
this.chStartOnClick = new Common.UI.CheckBox({ this.chStartOnClick = new Common.UI.CheckBox({
el: this.$el.findById('#transit-checkbox-slidenum'), el: this.$el.findById('#transit-checkbox-slidenum'),
labelText: this.strSlideNum labelText: this.strStartOnClick
}); });
@ -357,7 +351,8 @@ define([
this.renderComponent('#transit-spin-duration', this.numDuration); this.renderComponent('#transit-spin-duration', this.numDuration);
this.renderComponent('#transit-spin-delay', this.numDelay); this.renderComponent('#transit-spin-delay', this.numDelay);
this.renderComponent('#transit-checkbox-slidenum', this.chStartOnClick); this.renderComponent('#transit-checkbox-slidenum', this.chStartOnClick);
this.$el.find("#label-duration").innerText=this.strDuration;
this.$el.find("#label-delay").innerText=this.strDelay;
return this.$el; return this.$el;
}, },
@ -382,9 +377,9 @@ define([
var element=this.$el.find(compid); var element=this.$el.find(compid);
element.parent().append(obj.el); element.parent().append(obj.el);
}, },
setMenuParametrs:function (effect) setMenuParametrs:function (effect,value)
{ {
var minMax=[0,0]; var minMax=[-1,-1];
switch (effect) { switch (effect) {
case Asc.c_oAscSlideTransitionTypes.Fade: case Asc.c_oAscSlideTransitionTypes.Fade:
minMax=[0,1]; minMax=[0,1];
@ -412,16 +407,27 @@ define([
break; break;
} }
//this.btnParametrs.menu.clearAll(); //this.btnParametrs.menu.clearAll();
var selectedElement;
_.each(this.btnParametrs.menu.items,function (element,index){ _.each(this.btnParametrs.menu.items,function (element,index){
if(((index<minMax[0])||(index>minMax[1])))
element.$el.css('display',((index<minMax[0])||(index>minMax[1]))?'none':''); element.$el.css('display','none');
else {
element.$el.css('display','');
if (value != undefined) {
if (value == element.value)
selectedElement = element;
}
}
}); });
if(selectedElement==undefined)
selectedElement=this.btnParametrs.menu.items[minMax[0]];
if(effect!=Asc.c_oAscSlideTransitionTypes.None) if(effect!=Asc.c_oAscSlideTransitionTypes.None)
{ selectedElement.setChecked(true);
this.btnParametrs.menu.items[minMax[0]].$el.click();
} this.btnParametrs.setDisabled(effect==Asc.c_oAscSlideTransitionTypes.None);
this.btnPreview.setDisabled(effect==Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect==Asc.c_oAscSlideTransitionTypes.None);
return selectedElement;
}, },
@ -430,7 +436,7 @@ define([
txtParametrs: 'Parametrs', txtParametrs: 'Parametrs',
txtApplyToAll: 'Apply to All Slides', txtApplyToAll: 'Apply to All Slides',
strDuration: 'Duration', strDuration: 'Duration',
strSlideNum: 'Start On Click', strStartOnClick: 'Start On Click',
textNone: 'None', textNone: 'None',
textFade: 'Fade', textFade: 'Fade',
@ -441,6 +447,7 @@ define([
textCover: 'Cover', textCover: 'Cover',
textClock: 'Clock', textClock: 'Clock',
textZoom: 'Zoom', textZoom: 'Zoom',
textSmoothly: 'Smoothly', textSmoothly: 'Smoothly',
textBlack: 'Through Black', textBlack: 'Through Black',
textLeft: 'Left', textLeft: 'Left',