add functions

This commit is contained in:
OVSharova 2021-11-22 11:54:14 +03:00
parent 9961257432
commit 57937af17a
4 changed files with 2164 additions and 919 deletions

File diff suppressed because it is too large Load diff

View file

@ -75,7 +75,7 @@ define([
'tab:active': _.bind(this.onActiveTab, this) 'tab:active': _.bind(this.onActiveTab, this)
} }
}); });
this.EffectGroups = Common.define.effectData.getEffectGroupData();
}, },
onLaunch: function () { onLaunch: function () {
@ -116,11 +116,11 @@ define([
}, },
onPreviewClick: function() { onPreviewClick: function() {
Asc.asc_StartAnimationPreview();
}, },
onParameterClick: function (value) { onParameterClick: function (value) {
this._state.EffectType = value; this._state.EffectOption = value;
}, },
onAnimationPane: function() { onAnimationPane: function() {
@ -141,14 +141,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; var parameter = this._state.EffectOption;
if (this.Effect !== type)
parameter = this.view.setMenuParameters(type);
if (this.Effect !== type) {
parameter = this.view.setMenuParameters(type, parameter, true);
if (type != -10 && this.Effect == -10)
Asc.asc_AddAnimation(this.EffectGroups.findWhere({id: record.group}).value, type);
}
this._state.Effect = type; this._state.Effect = type;
this.onParameterClick(parameter); this.onParameterClick(parameter);
}, },
onStartSelect: function (combo, record) { onStartSelect: function (combo, record) {
@ -176,8 +177,11 @@ define([
}, },
loadSettings: function () { loadSettings: function () {
this._state.Effect = !this._state.Effect ? 2 : this._state.Effect;
this._state.EffectType = !this._state.EffectType ? this.view.setMenuParameters(this._state.Effect): this._state.EffectType; /* 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;
var value = 1000; var value = 1000;
if (Math.abs(this._state.Duration - value) > 0.001 || if (Math.abs(this._state.Duration - value) > 0.001 ||
@ -223,8 +227,8 @@ define([
this.view.btnParameters.setIconCls('toolbar__icon icon ' + item.get('imageUrl')); this.view.btnParameters.setIconCls('toolbar__icon icon ' + item.get('imageUrl'));
} }
if (me.btnParameters.menu.items.length > 0 && this._state.EffectType !== undefined) if (me.btnParameters.menu.items.length > 0 && this._state.EffectOption !== undefined)
me.setMenuParameters(this._state.Effect, this._state.EffectType); me.setMenuParameters(this._state.Effect, this._state.EffectOption);
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);

View file

@ -198,25 +198,25 @@
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>
<div class="group small a-table"> <div class="group small">
<div class="elset font-normal a-tr"> <div class="elset font-normal">
<div class="a-td"><label id="animation-label-start"></label></div> <label id="animation-label-start"></label>
<div class="a-td"><div class="btn-slot" style="width: 96px; " id="animation-start"></div></div> <div class="btn-slot" style="width: 96px; " id="animation-start"></div>
</div> </div>
<div class="elset font-normal a-tr bottom"> <div class="elset font-normal">
<div class="a-td"><label id="animation-delay"></label></div> <label id="animation-delay"></label>
<div class="a-td"><span id="animation-spin-delay" class="btn-slot text spinner" ></span></div> <span id="animation-spin-delay" class="btn-slot text spinner" ></span>
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>
<div class="group small a-table"> <div class="group small">
<div class="elset font-normal a-tr"> <div class="elset font-normal">
<div class="a-td"><label id="animation-duration"></label></div> <label id="animation-duration"></label>
<div class="a-td"><span id="animation-spin-duration" class="btn-slot text spinner" ></span></div> <span id="animation-spin-duration" class="btn-slot text spinner" ></span>
</div> </div>
<div class="elset font-normal a-tr bottom"> <div class="elset font-normal">
<div class="a-td"><label id="animation-label-trigger"></label></div> <label id="animation-label-trigger"></label>
<div class="a-td"><div class="btn-slot" style="width: 82px; " id="animation-trigger"></div></div> <div class="btn-slot" style="width: 82px; " id="animation-trigger"></div>
</div> </div>
</div> </div>
<div class="separator long"></div> <div class="separator long"></div>

View file

@ -127,18 +127,9 @@ define([
var _set = PE.enumLock; var _set = PE.enumLock;
this.lockedControls = []; this.lockedControls = [];
this._arrEffectName = [ this._arrEffectName = [{group:'none', value: -10, iconCls: 'transition-none', caption: this.textNone}];
{title: this.textNone, imageUrl: "transition-none", value: Asc.c_oAscSlideTransitionTypes.None, id: Common.UI.getId()}, Array.prototype.push.apply( this._arrEffectName, Common.define.effectData.getEffectData());
{title: this.textFade, imageUrl: "transition-fade", value: Asc.c_oAscSlideTransitionTypes.Fade, id: Common.UI.getId()}, this._arrEffectOptions = [];
{title: this.textPush, imageUrl: "transition-push", value: Asc.c_oAscSlideTransitionTypes.Push, id: Common.UI.getId()},
{title: this.textWipe, imageUrl: "transition-wipe", value: Asc.c_oAscSlideTransitionTypes.Wipe, id: Common.UI.getId()},
{title: this.textSplit, imageUrl: "transition-split", value: Asc.c_oAscSlideTransitionTypes.Split, id: Common.UI.getId()},
{title: this.textUnCover, imageUrl: "transition-uncover", value: Asc.c_oAscSlideTransitionTypes.UnCover, id: Common.UI.getId()},
{title: this.textCover, imageUrl: "transition-cover", value: Asc.c_oAscSlideTransitionTypes.Cover, id: Common.UI.getId()},
{title: this.textClock, imageUrl: "transition-clock", value: Asc.c_oAscSlideTransitionTypes.Clock, id: Common.UI.getId()},
{title: this.textZoom, imageUrl: "transition-zoom", value: Asc.c_oAscSlideTransitionTypes.Zoom, id: Common.UI.getId()}
];
this.listEffects = new Common.UI.ComboDataView({ this.listEffects = new Common.UI.ComboDataView({
cls: 'combo-styles', cls: 'combo-styles',
itemWidth: 87, itemWidth: 87,
@ -153,7 +144,6 @@ define([
menu = cmp.openButton.menu; menu = cmp.openButton.menu;
if (menu.cmpEl) { if (menu.cmpEl) {
menu.menuAlignEl = cmp.cmpEl; menu.menuAlignEl = cmp.cmpEl;
menu.menuAlign = 'tl-tl'; menu.menuAlign = 'tl-tl';
menu.cmpEl.css({ menu.cmpEl.css({
@ -168,7 +158,6 @@ define([
suppressScrollX: true suppressScrollX: true
}); });
} }
cmp.removeTips(); cmp.removeTips();
} }
}); });
@ -177,8 +166,8 @@ define([
this.listEffects.fieldPicker.itemTemplate = _.template([ this.listEffects.fieldPicker.itemTemplate = _.template([
'<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + (this.listEffects.itemWidth) + 'px;height: ' + (this.listEffects.itemHeight) + 'px;">', '<div class = "btn_item x-huge" id = "<%= id %>" style = "width: ' + (this.listEffects.itemWidth) + 'px;height: ' + (this.listEffects.itemHeight) + 'px;">',
'<div class = "icon toolbar__icon <%= imageUrl %>"></div>', '<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= title %></div>', '<div class = "caption"><%= caption %></div>',
'</div>' '</div>'
].join('')); ].join(''));
this.listEffects.menuPicker.itemTemplate = this.listEffects.fieldPicker.itemTemplate; this.listEffects.menuPicker.itemTemplate = this.listEffects.fieldPicker.itemTemplate;
@ -199,8 +188,7 @@ define([
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
caption: this.txtParameters, caption: this.txtParameters,
iconCls: 'toolbar__icon icon transition-none', iconCls: 'toolbar__icon icon transition-none',
menu: new Common.UI.Menu({ menu: new Common.UI.Menu({items: []}),
items: this.createParametersMenuItems()}),
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock], //lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock],
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
@ -440,60 +428,37 @@ define([
this.widthDuration = this.widthRow(this.$el.find("#animation-duration"), this.$el.find("#animation-label-trigger"),this.widthDuration); this.widthDuration = this.widthRow(this.$el.find("#animation-duration"), this.$el.find("#animation-label-trigger"),this.widthDuration);
}, },
setMenuParameters: function (effect, value) setMenuParameters: function (effectId, option, reload)
{ {
var minMax = [-1, -1]; var effect = this.listEffects.store.findWhere({value: effectId}).attributes;
switch (effect) { if(reload) {
case Asc.c_oAscSlideTransitionTypes.Fade: this._arrEffectOptions = Common.define.effectData.getEffectOptionsData(effect.group);
minMax = [0, 1];
break;
case Asc.c_oAscSlideTransitionTypes.Push:
minMax = [2, 5];
break;
case Asc.c_oAscSlideTransitionTypes.Wipe:
minMax = [2, 9];
break;
case Asc.c_oAscSlideTransitionTypes.Split:
minMax = [10, 13];
break;
case Asc.c_oAscSlideTransitionTypes.UnCover:
minMax = [2, 9];
break;
case Asc.c_oAscSlideTransitionTypes.Cover:
minMax = [2, 9];
break;
case Asc.c_oAscSlideTransitionTypes.Clock:
minMax = [14, 16];
break;
case Asc.c_oAscSlideTransitionTypes.Zoom:
minMax = [17, 19];
break;
} }
if (!this.listEffects.isDisabled()) {
this.btnParameters.setDisabled(effect.group === 'none' || !this._arrEffectOptions);
this.btnPreview.setDisabled(effect.group === 'none');
this.numDuration.setDisabled(effect.group === 'none');
}
if(!this._arrEffectOptions)
return undefined;
var selectedElement; var selectedElement;
_.each(this.btnParameters.menu.items, function (element, index) { this.btnParameters.menu.removeAll();
if (((index < minMax[0])||(index > minMax[1]))) //if(this._arrEffectOptions[effect.value].length>0) {
element.setVisible(false); if(this._arrEffectOptions[effect.value]) {
this._arrEffectOptions[effect.value].forEach(function (opt) {
this.btnParameters.menu.addItem(opt);
}, this);
selectedElement = this.btnParameters.menu.items[0];
}
else { else {
element.setVisible(true); selectedElement = undefined;
if (value != undefined) {
if (value == element.value) selectedElement = element;
} }
}
});
if (selectedElement == undefined)
selectedElement = this.btnParameters.menu.items[minMax[0]];
if (effect != Asc.c_oAscSlideTransitionTypes.None)
selectedElement.setChecked(true);
if (!this.listEffects.isDisabled()) { if (!this.listEffects.isDisabled()) {
this.btnParameters.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None); this.btnParameters.setDisabled(!selectedElement);
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
} }
return (selectedElement)?selectedElement.value:-1; return (selectedElement)?selectedElement.value:-1;
}, },