Сhanges for tab

This commit is contained in:
OVSharova 2021-08-06 06:05:27 +03:00
parent 4054c1f3ec
commit ac7b7ca290
7 changed files with 296 additions and 266 deletions

View file

@ -131,8 +131,7 @@ define([
'add:slide' : this.onAddSlide.bind(this),
'change:slide' : this.onChangeSlide.bind(this),
'change:compact' : this.onClickChangeCompact,
'add:chart' : this.onSelectChart,
'transit:settab' : this.setTrantitTab
'add:chart' : this.onSelectChart
},
'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'),

View file

@ -49,8 +49,7 @@ define([
PE.Controllers.Transitions = Backbone.Controller.extend(_.extend({
models : [],
collections : [
],
collections : [],
views : [
'PE.Views.Transitions'
],
@ -62,7 +61,6 @@ define([
initialize: function () {
this.addListeners({
'PE.Views.Transitions': {
'transit:preview': _.bind(this.onPreviewClick, this),
'transit:parametrs': _.bind(this.onParametrClick, this),
@ -72,14 +70,18 @@ define([
'transit:startonclick': _.bind(this.onStartOnClickChange, this),
'transit:delay': _.bind(this.onDelayChange, this),
'transit:checkdelay': _.bind(this.onCheckDelayChange, this)
},
'Toolbar': {
'tab:active': _.bind(this.onActiveTab, this)
}
});
},
onLaunch: function () {
this._state = {};
//Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},
setConfig: function (config) {
this.appConfig = config.mode;
@ -96,22 +98,10 @@ define([
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this));
return this;
},
onApiCountPagesRestricted: function (count) {
if (this._state.no_slides !== (count<=0)) {
/*if (this._state.no_slides !== (count <= 0))*/
this._state.no_slides = (count <= 0);
this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides);
}
},
loadDocument: function(data) {
this.document = data.doc;
},
SetDisabled: function(state) {
/*if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(state, this.langs);*/
//this.setPreviewMode(state);
},
createToolbarPanel: function() {
@ -123,15 +113,12 @@ define([
this.view : Backbone.Controller.prototype.getView.call(this, name);
},
onAppReady: function (config) {
var me = this;
},
onPreviewClick: function() {
if (this.api) {
this.api.SlideTransitionPlay();
}
},
onParametrClick: function (item) {
this.EffectType = item.value;
if (this.api && !this._noApply) {
@ -143,6 +130,7 @@ define([
this.api.SetSlideProps(props);
}
},
onDurationChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
@ -152,6 +140,7 @@ define([
this.api.SetSlideProps(props);
}
},
onStartOnClickChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
@ -161,6 +150,7 @@ define([
this.api.SetSlideProps(props);
}
},
onDelayChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
@ -170,6 +160,7 @@ define([
this.api.SetSlideProps(props);
}
},
onCheckDelayChange: function(field, newValue, oldValue, eOpts) {
this.view.numDelay.setDisabled(field.getValue() !== 'checked');
if (this.api && !this._noApply) {
@ -180,20 +171,23 @@ define([
this.api.SetSlideProps(props);
}
},
onApplyToAllClick: function () {
if (this.api) this.api.SlideTransitionApplyToAll();
},
onEffectSelect: function (combo, record) {
var type = record.get('value');
if (this.Effect !== type &&
!((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))) {
var parametr = this.view.setMenuParametrs(type);
if (parametr)
this.onParametrClick(parametr);
}
this.Effect = type;
if (this.api && !this._noApply) {
var props = new Asc.CAscSlideProps();
var transition = new Asc.CAscSlideTransition();
@ -203,71 +197,45 @@ define([
this.api.SetSlideProps(props);
}
},
onFocusObject: function(selectedObjects) {
var me = this;
for (var i = 0; i<selectedObjects.length; i++) {
var eltype = selectedObjects[i].get_ObjectType();
if (eltype === undefined)
continue;
if (eltype == Asc.c_oAscTypeSelectElement.Slide) {
var slide_deleted = undefined,
locked_transition=undefined,
pr;
me._state.activated=me.view.toolbar.activated;
var locked_transition = undefined,
pr = selectedObjects[i].get_ObjectValue();
slide_deleted = pr.get_LockDelete();
locked_transition = pr.get_LockTransition();
// if (slide_deleted !== undefined && me._state.slidecontrolsdisable !== slide_deleted) {
// if (me._state.activated) me._state.slidecontrolsdisable = slide_deleted;
// me.lockToolbar(PE.enumLock.slideDeleted, slide_deleted);
// }
if (locked_transition !== undefined && me._state.lockedtransition !== locked_transition ) {
if (me._state.activated) me._state.lockedtransition = locked_transition;
me.lockToolbar(PE.enumLock.transitLock, locked_transition);
}
if (locked_transition !== undefined && me._state.lockedtransition !== locked_transition)
if (me.view.toolbar._state.activated) me._state.lockedtransition = locked_transition;
}
this.changeSettings(pr);
}
this.loadSettings(pr);
if (this._state.onactivetab) {
this.setLocked();
this.setSettings();
}
}
}
},
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.view.lockedControls);
},
changeSettings:function (props){
var me=this.view;
loadSettings: function (props) {
var transition = props.get_transition();
if (transition) {
var value = transition.get_TransitionType();
var found = false;
if (this._state.Effect !== value) {
var item = me.listEffects.store.findWhere({value: value});
if (item) {
found = true;
me.listEffects.menuPicker.selectRecord(item);
this._state.Effect = value;
} else
me.listEffects.menuPicker.selectRecord(me.listEffects.menuPicker.items[0]);
}
this._state.Effect = transition.get_TransitionType();
this._state.EffectType = transition.get_TransitionOption();
if (me.btnParametrs.menu.items.length>0) {
value = transition.get_TransitionOption();
me.setMenuParametrs(this._state.Effect, value);
this._state.EffectType = value;
}
value = transition.get_TransitionDuration();
var 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)) {
me.numDuration.setValue((value !== null && value !== undefined) ? value / 1000. : '', true);
this._state.Duration = value;
}
@ -275,22 +243,51 @@ define([
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)) {
me.numDelay.setValue((value !== null && value !== undefined) ? value / 1000. : '', true);
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;
this._state.OnMouseClick = transition.get_SlideAdvanceOnMouseClick();
this._state.AdvanceAfter = transition.get_SlideAdvanceAfter();
}
value = transition.get_SlideAdvanceAfter();
if (this._state.AdvanceAfter !== value) {
me.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
me.numDelay.setDisabled(me.chDelay.getValue() !== 'checked');
this._state.AdvanceAfter = value;
},
onActiveTab: function(tab) {
if (tab == 'transit') {
this._state.onactivetab = true;
this.setLocked();
this.setSettings();
}
else this._state.onactivetab = false;
},
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.view.lockedControls);
},
setLocked: function() {
if (this._state.lockedtransition != undefined)
this.lockToolbar(PE.enumLock.transitLock, this._state.lockedtransition);
if (this._state.no_slides != undefined)
this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides);
},
setSettings: function () {
var me = this.view;
if (this._state.Effect !== undefined) {
var item = me.listEffects.store.findWhere({value: this._state.Effect});
me.listEffects.menuPicker.selectRecord(item ? item : me.listEffects.menuPicker.items[0]);
}
if (me.btnParametrs.menu.items.length > 0 && this._state.EffectType !== undefined)
me.setMenuParametrs(this._state.Effect, this._state.EffectType);
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.chStartOnClick.setValue((this._state.OnMouseClick !== null && this._state.OnMouseClick !== undefined) ? this._state.OnMouseClick : 'indeterminate', true);
me.chDelay.setValue((this._state.AdvanceAfter !== null && this._state.AdvanceAfter !== undefined) ? this._state.AdvanceAfter : 'indeterminate', true);
me.numDelay.setDisabled(me.chDelay.getValue() !== 'checked' || me.chDelay.disabled);
}
}, PE.Controllers.Transitions || {}));
});

View file

@ -1,36 +0,0 @@
<section id="transitions-panel" class="panel" data-tab="transit">
<div class="group flex small" id="transit-field-effects" style=" width: 700px; min-width: 300px;"></div>
<div class="group small">
<span class="btn-slot text x-huge" id="transit-button-parametrs"></span>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset font-normal">
<label><%=Duration%></label>
<span id="transit-spin-duration" class="btn-slot text spinner"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="transit-button-preview"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="transit-checkbox-startonclick"></span>
</div>
<div class="elset font-normal">
<span class="btn-slot text" id="transit-checkbox-delay"></span>
<div id="transit-spin-delay" class="btn-slot text spinner"></div>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text " id="transit-button-apply"></span>
</div>
<div class="elset">
<span class="btn-slot text x-huge"></span>
</div>
</div>
</section>

View file

@ -1039,7 +1039,6 @@ define([
var _injectComponent = function (id, cmp) {
Common.Utils.injectComponent($host.find(id), cmp);
};
//this.fireEvent('transit:settab',[$host]);
_injectComponent('#slot-field-fontname', this.cmbFontName);
_injectComponent('#slot-field-fontsize', this.cmbFontSize);
_injectComponent('#slot-btn-changeslide', this.btnChangeSlide);

View file

@ -43,7 +43,6 @@
define([
'text!presentationeditor/main/app/template/Transitions.template',
'common/main/lib/util/utils',
'common/main/lib/component/Button',
'common/main/lib/component/DataView',
@ -52,7 +51,7 @@ define([
'presentationeditor/main/app/view/SlideSettings',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/Window'
], function (template) {
], function () {
'use strict';
PE.Views.Transitions = Common.UI.BaseView.extend(_.extend((function() {
@ -63,40 +62,47 @@ define([
me.fireEvent('transit:selecteffect', [combo, record]);
}, me));
}
if (me.btnPreview) {
me.btnPreview.on('click', _.bind(function(btn) {
me.fireEvent('transit:preview', [me.btnPreview]);
}, me));
}
if(me.btnParametrs) {
me.btnParametrs.on('click', function (e) {
me.fireEvent('transit:parametrs', ['current']);
if (me.btnParameters) {
me.btnParameters.on('click', function (e) {
me.fireEvent('transit:Parameters', ['current']);
});
me.btnParametrs.menu.on('item:click', function (menu, item, e) {
me.fireEvent('transit:parametrs', [item]);
me.btnParameters.menu.on('item:click', function (menu, item, e) {
me.fireEvent('transit:Parameters', [item]);
});
}
if (me.btnApplyToAll) {
me.btnApplyToAll.on('click', _.bind(function(btn) {
me.fireEvent('transit:applytoall', [me.btnApplyToAll]);
}, me));
}
if (me.numDuration) {
me.numDuration.on('change', function(bth) {
me.fireEvent('transit:duration', [me.numDuration]);
}, me);
}
if (me.numDelay) {
me.numDelay.on('change', function(bth) {
me.fireEvent('transit:delay', [me.numDelay]);
}, me);
}
if (me.chStartOnClick) {
me.chStartOnClick.on('change', _.bind(function (e) {
me.fireEvent('transit:startonclick', [me.chStartOnClick, me.chStartOnClick.value, me.chStartOnClick.lastValue]);
}, me));
}
if (me.chDelay) {
me.chDelay.on('change', _.bind(function (e) {
me.fireEvent('transit:checkdelay', [me.chDelay, me.chDelay.value, me.chDelay.lastValue]);
@ -182,16 +188,16 @@ define([
});
this.lockedControls.push(this.btnPreview);
this.btnParametrs = new Common.UI.Button({
this.btnParameters = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtParametrs,
caption: this.txtParameters,
iconCls: 'toolbar__icon icon btn-insertshape',
menu: new Common.UI.Menu({
maxHeight:115,
items: this.createParametrsMenuItems()}),
items: this.createParametersMenuItems()}),
lock:[_set.slideDeleted, _set.noSlides, _set.disableOnStart, _set.transitLock]
});
this.lockedControls.push(this.btnParametrs);
this.lockedControls.push(this.btnParameters);
this.btnApplyToAll = new Common.UI.Button({
cls: 'btn-toolbar',
@ -252,7 +258,7 @@ define([
return this;
},
createParametrsMenuItems: function()
createParametersMenuItems: function()
{
var arrEffectType = [
{caption: this.textSmoothly, value: Asc.c_oAscSlideTransitionParams.Fade_Smoothly},
@ -279,17 +285,16 @@ define([
var itemsMenu = [];
_.each(arrEffectType, function (item) {
itemsMenu.push(
{
itemsMenu.push({
caption: item.caption,
value: item.value,
checkable: true,
toggleGroup: 'effects'
}
);
});
});
return itemsMenu;
},
onAppReady: function (config) {
var me = this;
(new Promise(function (accept, reject) {
@ -303,7 +308,7 @@ define([
getPanel: function () {
this.listEffects && this.listEffects.render(this.$el.find('#transit-field-effects'));
this.btnPreview && this.btnPreview.render(this.$el.find('#transit-button-preview'));
this.btnParametrs && this.btnParametrs.render(this.$el.find('#transit-button-parametrs'));
this.btnParameters && this.btnParameters.render(this.$el.find('#transit-button-Parameters'));
this.btnApplyToAll && this.btnApplyToAll.render(this.$el.find('#transit-button-apply'));
this.renderComponent('#transit-spin-duration', this.numDuration);
this.renderComponent('#transit-spin-delay', this.numDelay);
@ -312,6 +317,7 @@ define([
this.$el.find("#label-delay").innerText = this.strDelay;
return this.$el;
},
renderComponent: function (compid, obj)
{
var element = this.$el.find(compid);
@ -328,13 +334,14 @@ define([
return this.lockedControls;
return [];
},
setDisabled: function (state) {
this.lockedControls && this.lockedControls.forEach(function (button) {
button.setDisabled(state);
}, this);
},
setMenuParametrs:function (effect,value)
setMenuParameters: function (effect, value)
{
var minMax = [-1, -1];
switch (effect) {
@ -363,28 +370,29 @@ define([
minMax = [17, 19];
break;
}
var selectedElement;
_.each(this.btnParametrs.menu.items,function (element,index){
_.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', '');
if (value != undefined) {
if (value == element.value)
selectedElement = element;
if (value == element.value) selectedElement = element;
}
}
});
if (selectedElement == undefined)
selectedElement=this.btnParametrs.menu.items[minMax[0]];
selectedElement = this.btnParameters.menu.items[minMax[0]];
if (effect != Asc.c_oAscSlideTransitionTypes.None)
selectedElement.setChecked(true);
if (!this.listEffects.isDisabled()) {
this.numDelay.setDisabled(this.chDelay.getValue() !== 'checked');
this.btnParametrs.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.btnParameters.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.btnPreview.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
this.numDuration.setDisabled(effect === Asc.c_oAscSlideTransitionTypes.None);
}
@ -394,7 +402,7 @@ define([
txtSec: 's',
txtPreview: 'Preview',
txtParametrs: 'Parametrs',
txtParameters: 'Parameters',
txtApplyToAll: 'Apply to All Slides',
strDuration: 'Duration',
strDelay: 'Delay',

View file

@ -2008,5 +2008,42 @@
"PE.Views.Toolbar.txtScheme8": "Flow",
"PE.Views.Toolbar.txtScheme9": "Foundry",
"PE.Views.Toolbar.txtSlideAlign": "Align to Slide",
"PE.Views.Toolbar.txtUngroup": "Ungroup"
"PE.Views.Toolbar.txtUngroup": "Ungroup",
"PE.Views.Transitions.txtSec": "s",
"PE.Views.Transitions.txtPreview": "Preview",
"PE.Views.Transitions.txtParameters": "Parameters",
"PE.Views.Transitions.txtApplyToAll": "Apply to All Slides",
"PE.Views.Transitions.strDuration": "Duration",
"PE.Views.Transitions.strDelay": "Delay",
"PE.Views.Transitions.strStartOnClick": "Start On Click",
"PE.Views.Transitions.textNone": "None",
"PE.Views.Transitions.textFade": "Fade",
"PE.Views.Transitions.textPush": "Push",
"PE.Views.Transitions.textWipe": "Wipe",
"PE.Views.Transitions.textSplit": "Split",
"PE.Views.Transitions.textUnCover": "UnCover",
"PE.Views.Transitions.textCover": "Cover",
"PE.Views.Transitions.textClock": "Clock",
"PE.Views.Transitions.textZoom": "Zoom",
"PE.Views.Transitions.textSmoothly": "Smoothly",
"PE.Views.Transitions.textBlack": "Through Black",
"PE.Views.Transitions.textLeft": "Left",
"PE.Views.Transitions.textTop": "Top",
"PE.Views.Transitions.textRight": "Right",
"PE.Views.Transitions.textBottom": "Bottom",
"PE.Views.Transitions.textTopLeft": "Top-Left",
"PE.Views.Transitions.textTopRight": "Top-Right",
"PE.Views.Transitions.textBottomLeft": "Bottom-Left",
"PE.Views.Transitions.textBottomRight": "Bottom-Right",
"PE.Views.Transitions.textVerticalIn": "Vertical In",
"PE.Views.Transitions.textVerticalOut": "Vertical Out",
"PE.Views.Transitions.textHorizontalIn": "Horizontal In",
"PE.Views.Transitions.textHorizontalOut": "Horizontal Out",
"PE.Views.Transitions.textClockwise": "Clockwise",
"PE.Views.Transitions.textCounterclockwise": "Counterclockwise",
"PE.Views.Transitions.textWedge": "Wedge",
"PE.Views.Transitions.textZoomIn": "Zoom In",
"PE.Views.Transitions.textZoomOut": "Zoom Out",
"PE.Views.Transitions.textZoomRotate": "Zoom and Rotate",
"PE.Views.Toolbar.textTabTransitions": "Transitions"
}

View file

@ -17,6 +17,7 @@
border-color: @border-preview-select;
}
.style{
background: transparent;
}
@ -24,7 +25,7 @@
.btn {
border: none;
&:hover {
background-color: transparent;
background: transparent;
}
.icon
{
@ -33,4 +34,29 @@
}
}
.combo-dataview
{
&.disabled {
.item {
&:hover:not(.selected) {
border-color: transparent;
}
.btn{
background: transparent;
cursor: default;
&:active,
&.active {
.icon {opacity: @component-normal-icon-opacity;}
}
}
}
}
}
.spinner
{
margin-left: 10px;
}
}