From 8e67fbc9a5ba890ebff6238c54a7fa1ba4e18133 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Mon, 19 Jul 2021 15:08:11 +0300 Subject: [PATCH] Create button preview --- .../main/app/controller/Main.js | 3 +- .../main/app/controller/Transitions.js | 57 +++++++------------ .../main/app/view/Transitions.js | 33 +++++++++-- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 9912a8761..6779a241b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -995,7 +995,8 @@ define([ review: true, viewport: true, documentHolder: true, - toolbar: true + toolbar: true, + transit:true }, temp ? 'reconnect' : 'disconnect'); }, diff --git a/apps/presentationeditor/main/app/controller/Transitions.js b/apps/presentationeditor/main/app/controller/Transitions.js index b1ab3e3f3..d3bd79fb7 100644 --- a/apps/presentationeditor/main/app/controller/Transitions.js +++ b/apps/presentationeditor/main/app/controller/Transitions.js @@ -57,37 +57,19 @@ define([ this.addListeners({ /*'FileMenu': { - 'settings:apply': this.applySettings.bind(this) + 'settings:apply': this.applySettings.bind(this), },*/ 'PE.Views.Transitions': { - //'transit:accept': _.bind(this.onAcceptClick, this), - //'transit:reject': _.bind(this.onRejectClick, this), - //'transit:delete': _.bind(this.onDeleteClick, this), - //'transit:preview': _.bind(this.onBtnPreviewClick, this), - //'transit:view': _.bind(this.onReviewViewClick, this), - //'transit:compare': _.bind(this.onCompareClick, this), - //'lang:document': _.bind(this.onDocLanguage, this) - /*, - 'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)*/ - }, - 'Common.Views.ReviewChangesDialog': { - //'transit:accept': _.bind(this.onAcceptClick, this), - //'transit:reject': _.bind(this.onRejectClick, this), - //'transit:preview': _.bind(this.onBtnPreviewClick, this) - }, - 'Common.Views.ReviewPopover': { - //'transit:accept': _.bind(this.onAcceptClick, this), - //'transit:reject': _.bind(this.onRejectClick, this), - //'transit:delete': _.bind(this.onDeleteClick, this), - //'transit:goto': _.bind(this.onGotoClick, this) + 'transit:preview': _.bind(this.onPreviewClick, this) } }); }, onLaunch: function () { - this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/}; + this._state = {}; + //this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null /*new AscCommon.CComparisonPr()*/}; - Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + //Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, setConfig: function (data, api) { this.setApi(api); @@ -99,21 +81,13 @@ define([ return this; }, setApi: function (api) { + this.api = api; if (api) { - this.api = api; - - /*if (this.appConfig.canReview || this.appConfig.canViewReview) { - this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this)); - this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this)); - this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this)); - this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this)); + if (this.api) { + this.api.SetInterfaceDrawImagePlaceSlide('slide-texture-img'); + //this.api.asc_registerCallback('asc_onInitStandartTextures', _.bind(this.onInitStandartTextures, this)); } - if (this.appConfig.canReview) - this.api.asc_registerCallback('asc_onOnTrackRevisionsChange', _.bind(this.onApiTrackRevisionsChange, this));*/ - //this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this)); - //this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); - // Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this)); } }, @@ -130,9 +104,9 @@ define([ }, SetDisabled: function(state) { - if (this.dlgChanges) + /*if (this.dlgChanges) this.dlgChanges.close(); - this.view && this.view.SetDisabled(state, this.langs); + this.view && this.view.SetDisabled(state, this.langs);*/ //this.setPreviewMode(state); }, @@ -200,7 +174,14 @@ define([ me.view.btnCommentRemove && me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true)); me.view.btnCommentResolve && me.view.btnCommentResolve.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true)); } + }, + onPreviewClick: function() + { + alert("hf,jnftn"); + if (this.api) { + alert("api"); + this.api.SlideTransitionPlay(); + } } - }, PE.Controllers.Transitions || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/Transitions.js b/apps/presentationeditor/main/app/view/Transitions.js index 7158a3dff..766a6cfcd 100644 --- a/apps/presentationeditor/main/app/view/Transitions.js +++ b/apps/presentationeditor/main/app/view/Transitions.js @@ -50,7 +50,8 @@ define([ 'common/main/lib/component/Button', 'common/main/lib/component/DataView', 'common/main/lib/component/Layout', - "SlideSettings", + 'presentationeditor/main/app/view/SlideSettings', + 'common/main/lib/component/MetricSpinner', 'common/main/lib/component/Window' ], function () { 'use strict'; @@ -59,6 +60,9 @@ define([ var template = '
' + //'' + + '
' + + '' + + '
' + '
' + '' + '' + @@ -71,7 +75,18 @@ define([ function setEvents() { var me = this; - if (this.btnCommentRemove) { + if(this.btnPreview) + { + this.btnPreview.on('click', _.bind(function(btn){ + /* alert("hf,jnftn"); + if (this.api) { + alert("api"); + this.api.SlideTransitionPlay(); + }*/ + this.fireEvent('transit:preview', [me.btnPreview]); + }, this)); + } + /*if (this.btnCommentRemove) { this.btnCommentRemove.on('click', function (e) { me.fireEvent('comment:removeComments', ['current']); }); @@ -88,7 +103,7 @@ define([ this.btnCommentResolve.menu.on('item:click', function (menu, item, e) { me.fireEvent('comment:resolveComments', [item.value]); }); - } + }*/ } return { @@ -102,7 +117,12 @@ define([ this.appConfig = options.mode; var filter = Common.localStorage.getKeysFilter(); this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : ''; - + this.btnPreview = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + caption: this.txtPreview, + split: false, + iconCls: 'toolbar__icon btn-rem-comment' + }); this.btnCommentRemove = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', caption: this.txtCommentRemove, @@ -183,6 +203,7 @@ define([ getPanel: function () { this.$el = $(_.template(template)( {} )); + this.btnPreview && this.btnPreview.render(this.$el.find('#transit-button-preview')); this.btnCommentRemove && this.btnCommentRemove.render(this.$el.find('#slot-comment-remove')); this.btnCommentResolve && this.btnCommentResolve.render(this.$el.find('#slot-comment-resolve')); @@ -202,10 +223,14 @@ define([ }, SetDisabled: function (state, langs) { + //this.btnPreview && this.btnPreview.setDisabled(state|| !Common.Utils.InternalSettings.get()) this.btnCommentRemove && this.btnCommentRemove.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment")); this.btnCommentResolve && this.btnCommentResolve.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment")); }, + txtSec:'s', + txtPreview:'Preview', + txtCommentRemove: 'Remove', tipCommentRemCurrent: 'Remove current comments', tipCommentRem: 'Remove comments',