Merge pull request #1265 from ONLYOFFICE/fix/bug-53283

Fix/bug 53283
This commit is contained in:
Julia Radzhabova 2021-10-22 22:16:25 +03:00 committed by GitHub
commit 81870c9806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 36 deletions

View file

@ -121,20 +121,20 @@ define([
} }
}, },
onParameterClick: function (item) { onParameterClick: function (value) {
this.EffectType = item.value; this._state.EffectType = value;
if (this.api && !this._noApply) { if (this.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition(); var transition = new Asc.CAscSlideTransition();
transition.put_TransitionType(this.Effect); transition.put_TransitionType(this._state.Effect);
transition.put_TransitionOption(this.EffectType); transition.put_TransitionOption(this._state.EffectType);
props.put_transition(transition); props.put_transition(transition);
this.api.SetSlideProps(props); this.api.SetSlideProps(props);
} }
}, },
onDurationChange: function(field, newValue, oldValue, eOpts) { onDurationChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) { if (this.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition(); var transition = new Asc.CAscSlideTransition();
transition.put_TransitionDuration(field.getNumberValue()*1000); transition.put_TransitionDuration(field.getNumberValue()*1000);
@ -144,7 +144,7 @@ define([
}, },
onStartOnClickChange: function(field, newValue, oldValue, eOpts) { onStartOnClickChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) { if (this.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition(); var transition = new Asc.CAscSlideTransition();
transition.put_SlideAdvanceOnMouseClick(field.getValue() == 'checked'); transition.put_SlideAdvanceOnMouseClick(field.getValue() == 'checked');
@ -154,7 +154,7 @@ define([
}, },
onDelayChange: function(field, newValue, oldValue, eOpts) { onDelayChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) { if (this.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition(); var transition = new Asc.CAscSlideTransition();
transition.put_SlideAdvanceDuration(field.getNumberValue()*1000); transition.put_SlideAdvanceDuration(field.getNumberValue()*1000);
@ -165,7 +165,7 @@ define([
onCheckDelayChange: function(field, newValue, oldValue, eOpts) { onCheckDelayChange: function(field, newValue, oldValue, eOpts) {
this.view.numDelay.setDisabled(field.getValue() !== 'checked'); this.view.numDelay.setDisabled(field.getValue() !== 'checked');
if (this.api && !this._noApply) { if (this.api) {
var props = new Asc.CAscSlideProps(); var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition(); var transition = new Asc.CAscSlideTransition();
transition.put_SlideAdvanceAfter(field.getValue() == 'checked'); transition.put_SlideAdvanceAfter(field.getValue() == 'checked');
@ -180,24 +180,15 @@ define([
onEffectSelect: function (combo, record) { onEffectSelect: function (combo, record) {
var type = record.get('value'); var type = record.get('value');
var parameter = this._state.EffectType;
if (this.Effect !== type && if (this._state.Effect !== type &&
!((this.Effect === Asc.c_oAscSlideTransitionTypes.Wipe || this.Effect === Asc.c_oAscSlideTransitionTypes.UnCover || this.Effect === Asc.c_oAscSlideTransitionTypes.Cover)&& !((this._state.Effect === Asc.c_oAscSlideTransitionTypes.Wipe || this._state.Effect === Asc.c_oAscSlideTransitionTypes.UnCover || this._state.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)))
var parameter = this.view.setMenuParameters(type); parameter = this.view.setMenuParameters(type);
if (parameter)
this.onParameterClick(parameter);
}
this.Effect = type;
if (this.api && !this._noApply) { this._state.Effect = type;
var props = new Asc.CAscSlideProps(); this.onParameterClick(parameter);
var transition = new Asc.CAscSlideTransition();
transition.put_TransitionType(type);
transition.put_TransitionOption(this.EffectType);
props.put_transition(transition);
this.api.SetSlideProps(props);
}
}, },
onFocusObject: function(selectedObjects) { onFocusObject: function(selectedObjects) {
@ -273,7 +264,6 @@ define([
setSettings: function () { setSettings: function () {
var me = this.view; var me = this.view;
if (this._state.Effect !== undefined) { if (this._state.Effect !== undefined) {
var item = me.listEffects.store.findWhere({value: this._state.Effect}); var item = me.listEffects.store.findWhere({value: this._state.Effect});
me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]); me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]);

View file

@ -70,12 +70,9 @@ define([
} }
if (me.btnParameters) { if (me.btnParameters) {
me.btnParameters.on('click', function (e) {
me.fireEvent('transit:parameters', ['current']);
});
me.btnParameters.menu.on('item:click', function (menu, item, e) { me.btnParameters.menu.on('item:click', function (menu, item, e) {
me.fireEvent('transit:parameters', [item]); me.fireEvent('transit:parameters', [item.value]);
}); });
} }
@ -393,16 +390,16 @@ define([
} }
var selectedElement; var selectedElement;
_.each(this.btnParameters.menu.items, function (element, index) {
if (((index < minMax[0])||(index > minMax[1])))
element.$el.css('display', 'none');
else {
element.$el.css('display', '');
_.each(this.btnParameters.menu.items, function (element, index) {
if ((index >= minMax[0])&&(index <= minMax[1])) {
element.setVisible(true);
if (value != undefined) { if (value != undefined) {
if (value == element.value) selectedElement = element; if (value == element.value) selectedElement = element;
} }
} }
else
element.setVisible(false);
}); });
if (selectedElement == undefined) if (selectedElement == undefined)
@ -417,7 +414,7 @@ define([
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None); this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None); this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
} }
return selectedElement; return (selectedElement)?selectedElement.value:-1;
}, },