Refactoring: rename timing to transition

This commit is contained in:
Sergey Luzyanin 2020-12-02 13:11:49 +03:00
parent 847945c6a1
commit 6339b19437
6 changed files with 83 additions and 83 deletions

View file

@ -137,8 +137,8 @@ define([
if (settingsType==Common.Utils.documentSettingsType.Slide) { if (settingsType==Common.Utils.documentSettingsType.Slide) {
this._settings[settingsType].locked = value.get_LockDelete(); this._settings[settingsType].locked = value.get_LockDelete();
this._settings[settingsType].lockedBackground = value.get_LockBackground(); this._settings[settingsType].lockedBackground = value.get_LockBackground();
this._settings[settingsType].lockedEffects = value.get_LockTranzition(); this._settings[settingsType].lockedEffects = value.get_LockTransition();
this._settings[settingsType].lockedTiming = value.get_LockTiming(); this._settings[settingsType].lockedTransition = value.get_LockTransition();
this._settings[settingsType].lockedHeader = !!value.get_LockHeader && value.get_LockHeader(); this._settings[settingsType].lockedHeader = !!value.get_LockHeader && value.get_LockHeader();
} else { } else {
this._settings[settingsType].locked = value.get_Locked(); this._settings[settingsType].locked = value.get_Locked();
@ -183,7 +183,7 @@ define([
if (pnl.locked!==undefined) if (pnl.locked!==undefined)
this.rightmenu.slideSettings.setLocked(this._state.no_slides || pnl.lockedBackground || pnl.locked, this.rightmenu.slideSettings.setLocked(this._state.no_slides || pnl.lockedBackground || pnl.locked,
this._state.no_slides || pnl.lockedEffects || pnl.locked, this._state.no_slides || pnl.lockedEffects || pnl.locked,
this._state.no_slides || pnl.lockedTiming || pnl.locked, this._state.no_slides || pnl.lockedTransition || pnl.locked,
this._state.no_slides || pnl.lockedHeader || pnl.locked); this._state.no_slides || pnl.lockedHeader || pnl.locked);
} else } else
pnl.panel.setLocked(pnl.locked); pnl.panel.setLocked(pnl.locked);

View file

@ -892,9 +892,9 @@ define([
for (var i=0; i<selectedElements.length; i++) { for (var i=0; i<selectedElements.length; i++) {
if (Asc.c_oAscTypeSelectElement.Slide == selectedElements[i].get_ObjectType()) { if (Asc.c_oAscTypeSelectElement.Slide == selectedElements[i].get_ObjectType()) {
var elValue = selectedElements[i].get_ObjectValue(), var elValue = selectedElements[i].get_ObjectValue(),
timing = elValue.get_timing(); transition = elValue.get_transition();
if (timing) if (transition)
loop = timing.get_ShowLoop(); loop = transition.get_ShowLoop();
} }
} }
} }
@ -904,9 +904,9 @@ define([
loop = dlg.getSettings(); loop = dlg.getSettings();
if (me.api) { if (me.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_ShowLoop(loop); transition.put_ShowLoop(loop);
props.put_timing(timing); props.put_transition(transition);
me.api.SetSlideProps(props); me.api.SetSlideProps(props);
} }
} }

View file

@ -80,7 +80,7 @@ define([
this._locked = { this._locked = {
background: false, background: false,
effects: false, effects: false,
timing: false, transition: false,
header: false header: false
}; };
this._stateDisabled = {}; this._stateDisabled = {};
@ -261,7 +261,7 @@ define([
disabled: true disabled: true
}); });
this.btnApplyToAll.on('click', _.bind(function(btn){ this.btnApplyToAll.on('click', _.bind(function(btn){
if (this.api) this.api.SlideTimingApplyToAll(); if (this.api) this.api.SlideTransitionApplyToAll();
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
}, this)); }, this));
@ -1074,10 +1074,10 @@ define([
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();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_TransitionType(type); transition.put_TransitionType(type);
timing.put_TransitionOption(this.EffectType); transition.put_TransitionOption(this.EffectType);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
@ -1087,10 +1087,10 @@ define([
this.EffectType = record.value; this.EffectType = record.value;
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_TransitionType(this.Effect); transition.put_TransitionType(this.Effect);
timing.put_TransitionOption(this.EffectType); transition.put_TransitionOption(this.EffectType);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
@ -1099,9 +1099,9 @@ define([
onDurationChange: function(field, newValue, oldValue, eOpts){ onDurationChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_TransitionDuration(field.getNumberValue()*1000); transition.put_TransitionDuration(field.getNumberValue()*1000);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
@ -1109,9 +1109,9 @@ define([
onDelayChange: function(field, newValue, oldValue, eOpts){ onDelayChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceDuration(field.getNumberValue()*1000); transition.put_SlideAdvanceDuration(field.getNumberValue()*1000);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
@ -1119,9 +1119,9 @@ define([
onStartOnClickChange: function(field, newValue, oldValue, eOpts){ onStartOnClickChange: function(field, newValue, oldValue, eOpts){
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceOnMouseClick(field.getValue()=='checked'); transition.put_SlideAdvanceOnMouseClick(field.getValue()=='checked');
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
@ -1131,9 +1131,9 @@ define([
this.numDelay.setDisabled(field.getValue()!=='checked'); this.numDelay.setDisabled(field.getValue()!=='checked');
if (this.api && !this._noApply) { if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var timing = new Asc.CAscSlideTiming(); var transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceAfter(field.getValue()=='checked'); transition.put_SlideAdvanceAfter(field.getValue()=='checked');
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
@ -1196,7 +1196,7 @@ define([
ChangeSettings: function(props) { ChangeSettings: function(props) {
if (this._initSettings) if (this._initSettings)
this.createDelayedElements(); this.createDelayedElements();
this.SetSlideDisabled(this._locked.background, this._locked.effects, this._locked.timing, this._locked.header); this.SetSlideDisabled(this._locked.background, this._locked.effects, this._locked.transition, this._locked.header);
if (props) if (props)
{ {
@ -1382,9 +1382,9 @@ define([
this._state.SlideColor = this.SlideColor.Color; this._state.SlideColor = this.SlideColor.Color;
} }
var timing = props.get_timing(); var transition = props.get_transition();
if (timing) { if (transition) {
var value = timing.get_TransitionType(); var value = transition.get_TransitionType();
var found = false; var found = false;
if (this._state.Effect !== value) { if (this._state.Effect !== value) {
var item = this.cmbEffectName.store.findWhere({value: value}); var item = this.cmbEffectName.store.findWhere({value: value});
@ -1399,7 +1399,7 @@ define([
this._state.Effect = value; this._state.Effect = value;
} }
value = timing.get_TransitionOption(); value = transition.get_TransitionOption();
if (this._state.EffectType !== value || found) { if (this._state.EffectType !== value || found) {
found = false; found = false;
item = this.cmbEffectType.store.findWhere({value: value}); item = this.cmbEffectType.store.findWhere({value: value});
@ -1412,7 +1412,7 @@ define([
this._state.EffectType = value; this._state.EffectType = value;
} }
value = timing.get_TransitionDuration(); value = transition.get_TransitionDuration();
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) ) {
@ -1420,7 +1420,7 @@ define([
this._state.Duration=value; this._state.Duration=value;
} }
value = timing.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) ||
(this._state.Delay===undefined || value===undefined)&&(this._state.Delay!==value) ) { (this._state.Delay===undefined || value===undefined)&&(this._state.Delay!==value) ) {
@ -1428,12 +1428,12 @@ define([
this._state.Delay=value; this._state.Delay=value;
} }
value = timing.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); this.chStartOnClick.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this._state.OnMouseClick=value; this._state.OnMouseClick=value;
} }
value = timing.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); this.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
this.numDelay.setDisabled(this.chDelay.getValue()!=='checked'); this.numDelay.setDisabled(this.chDelay.getValue()!=='checked');
@ -1527,15 +1527,15 @@ define([
} }
}, },
setLocked: function (background, effects, timing, header) { setLocked: function (background, effects, transition, header) {
this._locked = { this._locked = {
background: background, effects: effects, timing: timing, header: header background: background, effects: effects, transition: transition, header: header
}; };
}, },
SetSlideDisabled: function(background, effects, timing, header) { SetSlideDisabled: function(background, effects, transition, header) {
this._locked = { this._locked = {
background: background, effects: effects, timing: timing, header: header background: background, effects: effects, transition: transition, header: header
}; };
if (this._initSettings) return; if (this._initSettings) return;
@ -1555,12 +1555,12 @@ define([
this.btnPreview.setDisabled(length<1 || effects); this.btnPreview.setDisabled(length<1 || effects);
this._stateDisabled.effects = effects; this._stateDisabled.effects = effects;
} }
if (timing !== this._stateDisabled.timing) { if (transition !== this._stateDisabled.transition) {
this.chStartOnClick.setDisabled(timing); this.chStartOnClick.setDisabled(transition);
this.chDelay.setDisabled(timing); this.chDelay.setDisabled(transition);
this.numDelay.setDisabled(timing || this.chDelay.getValue()!=='checked'); this.numDelay.setDisabled(transition || this.chDelay.getValue()!=='checked');
this.btnApplyToAll.setDisabled(timing); this.btnApplyToAll.setDisabled(transition);
this._stateDisabled.timing = timing; this._stateDisabled.transition = transition;
} }
if (header !== this._stateDisabled.header) { if (header !== this._stateDisabled.header) {
this.chSlideNum.setDisabled(header); this.chSlideNum.setDisabled(header);

View file

@ -166,7 +166,7 @@ define([
objectValue = object.get_ObjectValue(); objectValue = object.get_ObjectValue();
if (type == Asc.c_oAscTypeSelectElement.Slide) { if (type == Asc.c_oAscTypeSelectElement.Slide) {
slide_deleted = objectValue.get_LockDelete(); slide_deleted = objectValue.get_LockDelete();
slide_lock = objectValue.get_LockLayout() || objectValue.get_LockBackground() || objectValue.get_LockTranzition() || objectValue.get_LockTiming(); slide_lock = objectValue.get_LockLayout() || objectValue.get_LockBackground() || objectValue.get_LockTransition() || objectValue.get_LockTiming();
} else if (objectValue && _.isFunction(objectValue.get_Locked)) { } else if (objectValue && _.isFunction(objectValue.get_Locked)) {
no_object = false; no_object = false;
objectLocked = objectLocked || objectValue.get_Locked(); objectLocked = objectLocked || objectValue.get_Locked();

View file

@ -345,7 +345,7 @@ define([
no_text = false; no_text = false;
} }
} else if (Asc.c_oAscTypeSelectElement.Slide == type) { } else if (Asc.c_oAscTypeSelectElement.Slide == type) {
if ( !(objectValue.get_LockLayout() || objectValue.get_LockBackground() || objectValue.get_LockTranzition() || objectValue.get_LockTiming() )) if ( !(objectValue.get_LockLayout() || objectValue.get_LockBackground() || objectValue.get_LockTransition() || objectValue.get_LockTiming() ))
_settings.push('slide'); _settings.push('slide');
} else if (Asc.c_oAscTypeSelectElement.Image == type) { } else if (Asc.c_oAscTypeSelectElement.Image == type) {
if ( !objectValue.get_Locked() ) if ( !objectValue.get_Locked() )

View file

@ -180,25 +180,25 @@ define([
_initTransitionView: function () { _initTransitionView: function () {
var me = this; var me = this;
var timing = _slideObject.get_timing(); var transition = _slideObject.get_transition();
if (timing) { if (transition) {
_effect = timing.get_TransitionType(); _effect = transition.get_TransitionType();
me.getView('EditSlide').fillEffectTypes(_effect); me.getView('EditSlide').fillEffectTypes(_effect);
$('#edit-slide-effect .item-after').text(me.getView('EditSlide').getEffectName(_effect)); $('#edit-slide-effect .item-after').text(me.getView('EditSlide').getEffectName(_effect));
$('#edit-slide-effect-type').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None); $('#edit-slide-effect-type').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None);
$('#edit-slide-duration').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None); $('#edit-slide-duration').toggleClass('disabled', _effect == Asc.c_oAscSlideTransitionTypes.None);
_effectType = timing.get_TransitionOption(); _effectType = transition.get_TransitionOption();
$('#edit-slide-effect-type .item-after').text((_effect != Asc.c_oAscSlideTransitionTypes.None) ? me.getView('EditSlide').getEffectTypeName(_effectType) : ''); $('#edit-slide-effect-type .item-after').text((_effect != Asc.c_oAscSlideTransitionTypes.None) ? me.getView('EditSlide').getEffectTypeName(_effectType) : '');
_effectDuration = timing.get_TransitionDuration(); _effectDuration = transition.get_TransitionDuration();
$('#edit-slide-duration .item-after label').text((_effectDuration!==null && _effectDuration!==undefined) ? (parseInt(_effectDuration/1000.) + ' ' + me.textSec) : ''); $('#edit-slide-duration .item-after label').text((_effectDuration!==null && _effectDuration!==undefined) ? (parseInt(_effectDuration/1000.) + ' ' + me.textSec) : '');
$('#edit-slide-start-click input:checkbox').prop('checked', !!timing.get_SlideAdvanceOnMouseClick()); $('#edit-slide-start-click input:checkbox').prop('checked', !!transition.get_SlideAdvanceOnMouseClick());
$('#edit-slide-delay input:checkbox').prop('checked', !!timing.get_SlideAdvanceAfter()); $('#edit-slide-delay input:checkbox').prop('checked', !!transition.get_SlideAdvanceAfter());
$('#edit-slide-delay .item-content:nth-child(2)').toggleClass('disabled',!timing.get_SlideAdvanceAfter()); $('#edit-slide-delay .item-content:nth-child(2)').toggleClass('disabled',!transition.get_SlideAdvanceAfter());
_effectDelay = timing.get_SlideAdvanceDuration(); _effectDelay = transition.get_SlideAdvanceDuration();
$('#edit-slide-delay .item-content:nth-child(2) .item-after').text((_effectDelay!==null && _effectDelay!==undefined) ? (parseInt(_effectDelay/1000.) + ' ' + me.textSec) : ''); $('#edit-slide-delay .item-content:nth-child(2) .item-after').text((_effectDelay!==null && _effectDelay!==undefined) ? (parseInt(_effectDelay/1000.) + ' ' + me.textSec) : '');
$('#edit-slide-delay .item-content:nth-child(2) input').val([(_effectDelay!==null && _effectDelay!==undefined) ? parseInt(_effectDelay/1000.) : 0]); $('#edit-slide-delay .item-content:nth-child(2) input').val([(_effectDelay!==null && _effectDelay!==undefined) ? parseInt(_effectDelay/1000.) : 0]);
} }
@ -266,10 +266,10 @@ define([
_effectType = this.getView('EditSlide').fillEffectTypes(_effect); _effectType = this.getView('EditSlide').fillEffectTypes(_effect);
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_TransitionType(_effect); transition.put_TransitionType(_effect);
timing.put_TransitionOption(_effectType); transition.put_TransitionOption(_effectType);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
@ -281,10 +281,10 @@ define([
_effectType = parseFloat($target.prop('value')); _effectType = parseFloat($target.prop('value'));
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_TransitionType(_effect); transition.put_TransitionType(_effect);
timing.put_TransitionOption(_effectType); transition.put_TransitionOption(_effectType);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
@ -302,9 +302,9 @@ define([
$('#edit-slide-duration .item-after label').text(duration + ' ' + this.textSec); $('#edit-slide-duration .item-after label').text(duration + ' ' + this.textSec);
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_TransitionDuration(_effectDuration); transition.put_TransitionDuration(_effectDuration);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
}, },
@ -312,9 +312,9 @@ define([
var $checkbox = $(e.currentTarget); var $checkbox = $(e.currentTarget);
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceOnMouseClick($checkbox.is(':checked')); transition.put_SlideAdvanceOnMouseClick($checkbox.is(':checked'));
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
}, },
@ -324,10 +324,10 @@ define([
$('#edit-slide-delay .item-content:nth-child(2)').toggleClass('disabled',!$checkbox.is(':checked')); $('#edit-slide-delay .item-content:nth-child(2)').toggleClass('disabled',!$checkbox.is(':checked'));
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceAfter($checkbox.is(':checked')); transition.put_SlideAdvanceAfter($checkbox.is(':checked'));
timing.put_SlideAdvanceDuration(_effectDelay); transition.put_SlideAdvanceDuration(_effectDelay);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
}, },
@ -339,9 +339,9 @@ define([
$('#edit-slide-delay .item-content:nth-child(2) .item-after').text(delay + ' ' + this.textSec); $('#edit-slide-delay .item-content:nth-child(2) .item-after').text(delay + ' ' + this.textSec);
var props = new Asc.CAscSlideProps(), var props = new Asc.CAscSlideProps(),
timing = new Asc.CAscSlideTiming(); transition = new Asc.CAscSlideTransition();
timing.put_SlideAdvanceDuration(_effectDelay); transition.put_SlideAdvanceDuration(_effectDelay);
props.put_timing(timing); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
}, },
@ -351,7 +351,7 @@ define([
}, },
onApplyAll: function (e) { onApplyAll: function (e) {
this.api.SlideTimingApplyToAll(); this.api.SlideTransitionApplyToAll();
}, },
// API handlers // API handlers