200 lines
6 KiB
JavaScript
200 lines
6 KiB
JavaScript
|
/*
|
||
|
*
|
||
|
* (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
|
||
|
*
|
||
|
*/
|
||
|
/**
|
||
|
* Animation.js
|
||
|
*
|
||
|
* Created by Olga.Animation on 13.10.21
|
||
|
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
define([
|
||
|
'core',
|
||
|
'jquery',
|
||
|
'underscore',
|
||
|
'backbone',
|
||
|
'presentationeditor/main/app/view/Animation'
|
||
|
], function () {
|
||
|
'use strict';
|
||
|
|
||
|
PE.Controllers.Animation = Backbone.Controller.extend(_.extend({
|
||
|
models : [],
|
||
|
collections : [],
|
||
|
views : [
|
||
|
'PE.Views.Animation'
|
||
|
],
|
||
|
options: {
|
||
|
alias: 'Animation'
|
||
|
},
|
||
|
sdkViewName : '#id_main',
|
||
|
|
||
|
initialize: function () {
|
||
|
|
||
|
this.addListeners({
|
||
|
'PE.Views.Animation': {
|
||
|
'animation:preview': _.bind(this.onPreviewClick, this),
|
||
|
'animation:parameters': _.bind(this.onParameterClick, this),
|
||
|
'animation:duration': _.bind(this.onDurationChange, this),
|
||
|
'animation:selecteffect': _.bind(this.onEffectSelect, this),
|
||
|
'animation:delay': _.bind(this.onDelayChange, this),
|
||
|
},
|
||
|
'Toolbar': {
|
||
|
'tab:active': _.bind(this.onActiveTab, this)
|
||
|
}
|
||
|
});
|
||
|
|
||
|
},
|
||
|
|
||
|
onLaunch: function () {
|
||
|
this._state = {};
|
||
|
},
|
||
|
|
||
|
setConfig: function (config) {
|
||
|
this.appConfig = config.mode;
|
||
|
|
||
|
this.view = this.createView('PE.Views.Animation', {
|
||
|
toolbar: config.toolbar,
|
||
|
mode: config.mode
|
||
|
});
|
||
|
return this;
|
||
|
},
|
||
|
|
||
|
setApi: function (api) {
|
||
|
this.api = api;
|
||
|
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onFocusObject, this));
|
||
|
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this));
|
||
|
return this;
|
||
|
},
|
||
|
|
||
|
onApiCountPages: function (count) {
|
||
|
if (this._state.no_slides !== (count<=0)) {
|
||
|
this._state.no_slides = (count<=0);
|
||
|
this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides);
|
||
|
}
|
||
|
},
|
||
|
|
||
|
createToolbarPanel: function() {
|
||
|
return this.view.getPanel();
|
||
|
},
|
||
|
|
||
|
getView: function(name) {
|
||
|
return !name && this.view ?
|
||
|
this.view : Backbone.Controller.prototype.getView.call(this, name);
|
||
|
},
|
||
|
|
||
|
onPreviewClick: function() {
|
||
|
|
||
|
},
|
||
|
|
||
|
onParameterClick: function (item) {
|
||
|
this.EffectType = item.value;
|
||
|
|
||
|
},
|
||
|
|
||
|
onDurationChange: function(field, newValue, oldValue, eOpts) {
|
||
|
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
onDelayChange: function(field, newValue, oldValue, eOpts) {
|
||
|
|
||
|
},
|
||
|
|
||
|
onCheckDelayChange: function(field, newValue, oldValue, eOpts) {
|
||
|
|
||
|
},
|
||
|
|
||
|
|
||
|
|
||
|
onEffectSelect: function (combo, record) {
|
||
|
var type = record.get('value');
|
||
|
|
||
|
if (this.Effect !== type) {
|
||
|
var parameter = this.view.setMenuParameters(type);
|
||
|
if (parameter)
|
||
|
this.onParameterClick(parameter);
|
||
|
}
|
||
|
this.Effect = type;
|
||
|
|
||
|
},
|
||
|
|
||
|
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) {
|
||
|
|
||
|
//this.loadSettings(pr);
|
||
|
|
||
|
if (this._state.onactivetab) {
|
||
|
this.setLocked();
|
||
|
this.setSettings();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
loadSettings: function (props) {
|
||
|
|
||
|
},
|
||
|
|
||
|
onActiveTab: function(tab) {
|
||
|
if (tab == 'animate') {
|
||
|
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);
|
||
|
},
|
||
|
|
||
|
setSettings: function () {
|
||
|
var me = this.view;
|
||
|
}
|
||
|
|
||
|
}, PE.Controllers.Animation || {}));
|
||
|
});
|