2021-07-16 14:31:23 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* (c) Copyright Ascensio System SIA 2010-2019
|
|
|
|
*
|
|
|
|
* This program is a free software product. You can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
|
|
|
* version 3 as published by the Free Software Foundation. In accordance with
|
|
|
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
|
|
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
|
|
|
* of any third-party rights.
|
|
|
|
*
|
|
|
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
|
|
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
*
|
|
|
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
|
|
|
* street, Riga, Latvia, EU, LV-1050.
|
|
|
|
*
|
|
|
|
* The interactive user interfaces in modified source and object code versions
|
|
|
|
* of the Program must display Appropriate Legal Notices, as required under
|
|
|
|
* Section 5 of the GNU AGPL version 3.
|
|
|
|
*
|
|
|
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
|
|
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
|
|
|
* grant you any rights under trademark law for use of our trademarks.
|
|
|
|
*
|
|
|
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
|
|
|
* well as technical writing content are licensed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
|
|
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/**
|
2021-07-17 10:47:50 +00:00
|
|
|
* Transitions.js
|
2021-07-16 14:31:23 +00:00
|
|
|
*
|
2021-07-17 10:47:50 +00:00
|
|
|
* Created by Olga.Transitions on 15.07.21
|
|
|
|
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
|
2021-07-16 14:31:23 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
define([
|
|
|
|
'core',
|
2021-07-23 00:45:03 +00:00
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
2021-07-17 23:15:10 +00:00
|
|
|
'presentationeditor/main/app/view/Transitions'
|
2021-07-16 14:31:23 +00:00
|
|
|
], function () {
|
|
|
|
'use strict';
|
|
|
|
|
2021-07-17 23:15:10 +00:00
|
|
|
PE.Controllers.Transitions = Backbone.Controller.extend(_.extend({
|
2021-07-16 14:31:23 +00:00
|
|
|
models : [],
|
|
|
|
collections : [
|
|
|
|
],
|
|
|
|
views : [
|
2021-07-17 23:15:10 +00:00
|
|
|
'PE.Views.Transitions'
|
2021-07-16 14:31:23 +00:00
|
|
|
],
|
2021-07-23 00:45:03 +00:00
|
|
|
options: {
|
|
|
|
alias: 'Transitions'
|
|
|
|
},
|
2021-07-16 14:31:23 +00:00
|
|
|
sdkViewName : '#id_main',
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
|
|
|
|
this.addListeners({
|
2021-07-17 10:47:50 +00:00
|
|
|
|
2021-07-17 23:15:10 +00:00
|
|
|
'PE.Views.Transitions': {
|
2021-07-20 02:35:56 +00:00
|
|
|
'transit:preview': _.bind(this.onPreviewClick, this),
|
|
|
|
'transit:parametrs': _.bind(this.onParametrClick,this),
|
|
|
|
'transit:duration': _.bind(this.onDurationChange,this),
|
2021-07-21 02:25:56 +00:00
|
|
|
'transit:applytoall': _.bind(this.onApplyToAllClick,this),
|
|
|
|
'transit:selecteffect': _.bind(this.onEffectSelect, this),
|
2021-07-25 20:12:20 +00:00
|
|
|
'transit:startonclick': _.bind(this.onStartOnClickChange,this),
|
2021-07-27 14:18:50 +00:00
|
|
|
'transit:delay': _.bind(this.onDelayChange,this),
|
|
|
|
'transit:checkdelay': _.bind(this.onCheckDelayChange,this)
|
2021-07-16 14:31:23 +00:00
|
|
|
}
|
|
|
|
});
|
2021-07-20 02:35:56 +00:00
|
|
|
|
2021-07-16 14:31:23 +00:00
|
|
|
},
|
|
|
|
onLaunch: function () {
|
2021-07-19 12:08:11 +00:00
|
|
|
this._state = {};
|
|
|
|
//Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
2021-07-17 10:47:50 +00:00
|
|
|
},
|
2021-07-30 17:22:42 +00:00
|
|
|
setConfig: function (config) {
|
|
|
|
this.appConfig = config.mode;
|
|
|
|
//this.setApi(config.api);
|
|
|
|
|
|
|
|
this.view = this.createView('PE.Views.Transitions', {
|
|
|
|
toolbar: config.toolbar,
|
|
|
|
mode: config.mode
|
|
|
|
});
|
|
|
|
|
2021-07-16 14:31:23 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
setApi: function (api) {
|
2021-07-19 12:08:11 +00:00
|
|
|
this.api = api;
|
2021-07-30 17:22:42 +00:00
|
|
|
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onFocusObject, this));
|
|
|
|
return this;
|
2021-07-16 14:31:23 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setMode: function(mode) {
|
|
|
|
this.appConfig = mode;
|
2021-07-30 17:22:42 +00:00
|
|
|
//this.view = this.createView('PE.Views.Transitions', { mode: mode });
|
2021-07-25 20:12:20 +00:00
|
|
|
return this;
|
2021-07-16 14:31:23 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
loadDocument: function(data) {
|
|
|
|
this.document = data.doc;
|
|
|
|
},
|
|
|
|
|
|
|
|
SetDisabled: function(state) {
|
2021-07-19 12:08:11 +00:00
|
|
|
/*if (this.dlgChanges)
|
2021-07-16 14:31:23 +00:00
|
|
|
this.dlgChanges.close();
|
2021-07-19 12:08:11 +00:00
|
|
|
this.view && this.view.SetDisabled(state, this.langs);*/
|
2021-07-17 10:47:50 +00:00
|
|
|
//this.setPreviewMode(state);
|
2021-07-16 14:31:23 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
createToolbarPanel: function() {
|
|
|
|
return this.view.getPanel();
|
|
|
|
},
|
|
|
|
|
|
|
|
getView: function(name) {
|
|
|
|
return !name && this.view ?
|
|
|
|
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
|
|
|
},
|
|
|
|
|
|
|
|
onAppReady: function (config) {
|
|
|
|
var me = this;
|
2021-07-21 02:25:56 +00:00
|
|
|
|
2021-07-19 12:08:11 +00:00
|
|
|
},
|
2021-07-20 02:35:56 +00:00
|
|
|
onPreviewClick: function(){
|
2021-07-19 12:08:11 +00:00
|
|
|
if (this.api) {
|
|
|
|
this.api.SlideTransitionPlay();
|
|
|
|
}
|
2021-07-20 02:35:56 +00:00
|
|
|
},
|
|
|
|
onParametrClick: function (item){
|
|
|
|
this.EffectType = item.value;
|
|
|
|
if (this.api && !this._noApply) {
|
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
|
|
|
transition.put_TransitionType(this.Effect);
|
|
|
|
transition.put_TransitionOption(this.EffectType);
|
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onDurationChange: function(field, newValue, oldValue, eOpts){
|
|
|
|
if (this.api && !this._noApply) {
|
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
|
|
|
transition.put_TransitionDuration(field.getNumberValue()*1000);
|
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
|
|
|
}
|
|
|
|
},
|
2021-07-25 20:12:20 +00:00
|
|
|
onStartOnClickChange: function(field, newValue, oldValue, eOpts){
|
|
|
|
if (this.api && !this._noApply) {
|
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
|
|
|
transition.put_SlideAdvanceOnMouseClick(field.getValue()=='checked');
|
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onDelayChange: function(field, newValue, oldValue, eOpts){
|
|
|
|
if (this.api && !this._noApply) {
|
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
|
|
|
transition.put_SlideAdvanceDuration(field.getNumberValue()*1000);
|
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onCheckDelayChange: function(field, newValue, oldValue, eOpts){
|
2021-07-27 14:18:50 +00:00
|
|
|
this.view.numDelay.setDisabled(field.getValue()!=='checked');
|
2021-07-21 02:25:56 +00:00
|
|
|
if (this.api && !this._noApply) {
|
2021-07-25 20:12:20 +00:00
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
2021-07-27 14:18:50 +00:00
|
|
|
transition.put_SlideAdvanceAfter(field.getValue()=='checked');
|
2021-07-25 20:12:20 +00:00
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
2021-07-21 02:25:56 +00:00
|
|
|
}
|
|
|
|
},
|
2021-07-20 02:35:56 +00:00
|
|
|
onApplyToAllClick: function (){
|
|
|
|
if (this.api) this.api.SlideTransitionApplyToAll();
|
2021-07-21 02:25:56 +00:00
|
|
|
},
|
|
|
|
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)) )
|
2021-07-25 20:12:20 +00:00
|
|
|
{
|
|
|
|
var parametr=this.view.setMenuParametrs(type);
|
|
|
|
if(parametr)
|
|
|
|
this.onParametrClick(parametr);
|
|
|
|
}
|
2021-07-21 02:25:56 +00:00
|
|
|
this.Effect = type;
|
|
|
|
if (this.api && !this._noApply) {
|
|
|
|
var props = new Asc.CAscSlideProps();
|
|
|
|
var transition = new Asc.CAscSlideTransition();
|
|
|
|
transition.put_TransitionType(type);
|
|
|
|
transition.put_TransitionOption(this.EffectType);
|
|
|
|
props.put_transition(transition);
|
|
|
|
this.api.SetSlideProps(props);
|
|
|
|
}
|
|
|
|
|
2021-07-21 23:09:53 +00:00
|
|
|
},
|
2021-07-23 00:45:03 +00:00
|
|
|
onFocusObject:function(selectedObjects){
|
2021-07-31 00:36:26 +00:00
|
|
|
for (var i=0; i<selectedObjects.length; i++) {
|
|
|
|
var eltype = selectedObjects[i].get_ObjectType();
|
|
|
|
|
|
|
|
if (eltype === undefined)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (eltype == Asc.c_oAscTypeSelectElement.Slide) {
|
|
|
|
this.changeSettings(selectedObjects[i].get_ObjectValue());
|
|
|
|
}
|
|
|
|
}
|
2021-07-23 00:45:03 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
changeSettings:function (props){
|
|
|
|
var me=this.view;
|
2021-07-25 20:12:20 +00:00
|
|
|
|
2021-07-21 23:09:53 +00:00
|
|
|
var transition = props.get_transition();
|
2021-07-23 00:45:03 +00:00
|
|
|
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);
|
2021-07-25 20:12:20 +00:00
|
|
|
this._state.Effect = value;
|
2021-07-23 00:45:03 +00:00
|
|
|
} else
|
|
|
|
me.listEffects.menuPicker.selectRecord(me.listEffects.menuPicker.items[0]);
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:22:42 +00:00
|
|
|
if (me.btnParametrs.menu.items.length>0) {
|
2021-07-25 20:12:20 +00:00
|
|
|
value = transition.get_TransitionOption();
|
|
|
|
me.setMenuParametrs(this._state.Effect, value);
|
|
|
|
this._state.EffectType = value;
|
2021-07-23 00:45:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2021-07-25 20:12:20 +00:00
|
|
|
|
2021-07-23 00:45:03 +00:00
|
|
|
value = transition.get_SlideAdvanceDuration();
|
|
|
|
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;
|
|
|
|
}
|
2021-07-21 23:09:53 +00:00
|
|
|
|
|
|
|
value = transition.get_SlideAdvanceOnMouseClick();
|
2021-07-25 20:12:20 +00:00
|
|
|
if (this._state.OnMouseClick !== value) {
|
|
|
|
me.chStartOnClick.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
|
|
|
|
this._state.OnMouseClick = value;
|
2021-07-21 23:09:53 +00:00
|
|
|
}
|
|
|
|
value = transition.get_SlideAdvanceAfter();
|
2021-07-25 20:12:20 +00:00
|
|
|
if (this._state.AdvanceAfter !== value) {
|
2021-07-27 14:18:50 +00:00
|
|
|
me.chDelay.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true);
|
|
|
|
me.numDelay.setDisabled(me.chDelay.getValue() !== 'checked');
|
2021-07-25 20:12:20 +00:00
|
|
|
this._state.AdvanceAfter = value;
|
2021-07-21 23:09:53 +00:00
|
|
|
}
|
2021-07-25 20:12:20 +00:00
|
|
|
}
|
2021-07-17 10:47:50 +00:00
|
|
|
}
|
2021-07-17 23:15:10 +00:00
|
|
|
}, PE.Controllers.Transitions || {}));
|
2021-07-16 14:31:23 +00:00
|
|
|
});
|