From 5a8605b80e27a30c4f3f3e10999ccaf0089b388e Mon Sep 17 00:00:00 2001 From: Sebastien Curt <sebastien.curt@tetras-libre.fr> Date: Wed, 4 May 2022 10:45:24 +0200 Subject: [PATCH] Fix popup close button --- capsule-prototype/js/PopupPanelWidget.js | 28 ++++++++++++++++++- capsule-prototype/js/online-script.js | 34 ++---------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js index 1fc13c7..149e3c5 100644 --- a/capsule-prototype/js/PopupPanelWidget.js +++ b/capsule-prototype/js/PopupPanelWidget.js @@ -187,7 +187,8 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { .click(function (event) { event.stopPropagation(); that.openEdition.call(that); - }); + }) + .css("background", that.tag.color);; this.popupTcInDiv = $('<div>'); this.popupTcInDiv @@ -733,6 +734,7 @@ function PopupPanelWidget(data) { return false; }; this.currentOpenedInput = undefined; + this.videoWasPlayingOnContentCreation = false; } PopupPanelWidget.prototype.getCurrentOpenedInput = function () { @@ -750,6 +752,10 @@ PopupPanelWidget.prototype.ensureLastOpenedEditionClosed = function () { PopupPanelWidget.prototype.createPopupContent = function (tag) { let that = this; + this.videoWasPlayingOnContentCreation = !window.app.rekall.Rekall().timeline.isPaused(); + if (this.videoWasPlayingOnContentCreation) { + window.app.rekall.Rekall().timeline.pause(); + } function createLeftPopup(popupPanelWidget) { let that = this; @@ -888,6 +894,12 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { tag: this, popupPanelWidget: popupPanelWidget }; + let closePopupDiv = $('<div id="closePopupEdit">✕</div>'); + closePopupDiv.click(function(){ + popupPanelWidget.close(); + }) + popupRightTd.append(closePopupDiv); + let projectNameInput = new AnnotationNamePanelInputEditor(commonDataForPanels) projectNameInput.appendInputEditorDiv(popupRightTd); @@ -918,4 +930,18 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { event.stopPropagation(); that.ensureLastOpenedEditionClosed(); }); +} + +PopupPanelWidget.prototype.show = function() { + $("#popupSpace").show(); + $("#popupEdit").show(); +} + +PopupPanelWidget.prototype.close = function() { + this.ensureLastOpenedEditionClosed(); + $("#popupSpace").hide(); + $("#popupEdit").hide(); + if(this.videoWasPlayingOnContentCreation) { + window.app.rekall.Rekall().timeline.play(); + } } \ No newline at end of file diff --git a/capsule-prototype/js/online-script.js b/capsule-prototype/js/online-script.js index 3ec267a..0cf345e 100644 --- a/capsule-prototype/js/online-script.js +++ b/capsule-prototype/js/online-script.js @@ -725,11 +725,7 @@ function closeInputs() { } function closeEdit() { - closeInputs(); - var isPaused = $("#popupEdit").attr("isPaused"); - if(isPaused=="false") rekall.timeline.play(); - $("#popupSpace").hide(); - $("#popupEdit").hide(); + popupPanel.close(); window.app.rekall.Rekall('pubSub').publish('popupEdit.updated', {}); } @@ -748,43 +744,17 @@ function openMosaic() { function fillPopupEdit(tag) { popupPanel.createPopupContent(tag); - var isPaused = rekall.timeline.isPaused(); - rekall.timeline.pause(); - - $("#popupEdit").attr("isPaused",isPaused); - $("#popupTC").css("background",tag.color); - - $("#popupNom").css("color",tag.color); - - // var labels = tag.getMetadata("Rekall->Labels"); - // $('input.annotation_labels').attr('checked', false); - // if (labels && labels != '') { - // var _labels = labels.split(';'); - // $('input.annotation_labels').toArray().forEach(e => { - // e.checked = (_labels.indexOf(e.value) != -1); - // }) - // } if(rekall_common.owner.canEdit) { $(".empty").show(); $(".displayMode").hide(); - $("#popupNomInput").val(tag.getMetadata("Rekall->Name")); - - var highlight = tag.getMetadata("Rekall->Highlight"); - if(highlight=="true") { - $("#popupEdit").addClass("highlightPopup"); - } - else { - $("#popupEdit").removeClass("highlightPopup"); - } } else { $(".empty").hide(); $(".editmode").hide(); $(".displayMode").show(); } - $("#popupSpace").show(); - $("#popupEdit").show(); + popupPanel.show(); } function convertToTime(seconds) { -- GitLab