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

View file

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

View file

@ -127,18 +127,9 @@ define([
var _set = PE.enumLock;
this.lockedControls = [];
this._arrEffectName = [
{title: this.textNone, imageUrl: "transition-none", value: Asc.c_oAscSlideTransitionTypes.None, id: Common.UI.getId()},
{title: this.textFade, imageUrl: "transition-fade", value: Asc.c_oAscSlideTransitionTypes.Fade, id: Common.UI.getId()},
{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._arrEffectName = [{group:'none', value: -10, iconCls: 'transition-none', caption: this.textNone}];
Array.prototype.push.apply( this._arrEffectName, Common.define.effectData.getEffectData());
this._arrEffectOptions = [];
this.listEffects = new Common.UI.ComboDataView({
cls: 'combo-styles',
itemWidth: 87,
@ -153,7 +144,6 @@ define([
menu = cmp.openButton.menu;
if (menu.cmpEl) {
menu.menuAlignEl = cmp.cmpEl;
menu.menuAlign = 'tl-tl';
menu.cmpEl.css({
@ -168,7 +158,6 @@ define([
suppressScrollX: true
});
}
cmp.removeTips();
}
});
@ -177,8 +166,8 @@ define([
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 = "icon toolbar__icon <%= imageUrl %>"></div>',
'<div class = "caption"><%= title %></div>',
'<div class = "icon toolbar__icon <%= iconCls %>"></div>',
'<div class = "caption"><%= caption %></div>',
'</div>'
].join(''));
this.listEffects.menuPicker.itemTemplate = this.listEffects.fieldPicker.itemTemplate;
@ -199,8 +188,7 @@ define([
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtParameters,
iconCls: 'toolbar__icon icon transition-none',
menu: new Common.UI.Menu({
items: this.createParametersMenuItems()}),
menu: new Common.UI.Menu({items: []}),
//lock: [_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock],
dataHint: '1',
dataHintDirection: 'bottom',
@ -440,60 +428,37 @@ define([
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];
switch (effect) {
case Asc.c_oAscSlideTransitionTypes.Fade:
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;
var effect = this.listEffects.store.findWhere({value: effectId}).attributes;
if(reload) {
this._arrEffectOptions = Common.define.effectData.getEffectOptionsData(effect.group);
}
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;
_.each(this.btnParameters.menu.items, function (element, index) {
if (((index < minMax[0])||(index > minMax[1])))
element.setVisible(false);
else {
element.setVisible(true);
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);
this.btnParameters.menu.removeAll();
//if(this._arrEffectOptions[effect.value].length>0) {
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 {
selectedElement = undefined;
}
if (!this.listEffects.isDisabled()) {
this.btnParameters.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.btnParameters.setDisabled(!selectedElement);
}
return (selectedElement)?selectedElement.value:-1;
},