Skip to content

Commit 29e7b86

Browse files
authored
UI is frozen till the first frame is initialized (#1320)
1 parent 5f0ad2a commit 29e7b86

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

cvat/apps/engine/static/engine/js/annotationSaver.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,12 @@ class AnnotationSaverController {
342342
this._autoSaveInterval = null;
343343

344344
const { shortkeys } = window.cvat.config;
345-
Mousetrap.bind(shortkeys.save_work.value, () => {
346-
this.save();
347-
return false;
348-
}, 'keydown');
345+
Mousetrap.bind(shortkeys.save_work.value, Logger.shortkeyLogDecorator(
346+
() => {
347+
this.save();
348+
return false;
349+
},
350+
), 'keydown');
349351
}
350352

351353
autoSave(enabled, time) {

cvat/apps/engine/static/engine/js/annotationUI.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,15 @@ function setupMenu(job, task, shapeCollectionModel,
488488
}
489489

490490

491-
function buildAnnotationUI(jobData, taskData, imageMetaData, annotationData, annotationFormats,
492-
loadJobEvent) {
491+
function buildAnnotationUI(
492+
jobData, taskData, imageMetaData,
493+
annotationData, annotationFormats, loadJobEvent,
494+
) {
493495
// Setup some API
494496
window.cvat = {
495497
labelsInfo: new LabelsInfo(taskData.labels),
496498
translate: new CoordinateTranslator(),
499+
frozen: true,
497500
player: {
498501
geometry: {
499502
scale: 1,
@@ -647,7 +650,6 @@ function buildAnnotationUI(jobData, taskData, imageMetaData, annotationData, ann
647650
playerModel.shift(window.cvat.search.get('frame') || 0, true);
648651

649652
const { shortkeys } = window.cvat.config;
650-
651653
setupHelpWindow(shortkeys);
652654
setupSettingsWindow();
653655
setupMenu(jobData, taskData, shapeCollectionModel,

cvat/apps/engine/static/engine/js/logger.js

+3
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ var Logger = {
451451
shortkeyLogDecorator: function(decoredFunc) {
452452
let self = this;
453453
return function(e, combo) {
454+
if (window.cvat.frozen) {
455+
return;
456+
}
454457
let pressKeyEvent = self.addContinuedEvent(self.EventType.pressShortcut, {key: combo});
455458
let returnValue = decoredFunc(e, combo);
456459
pressKeyEvent.close();

cvat/apps/engine/static/engine/js/player.js

+6
Original file line numberDiff line numberDiff line change
@@ -941,10 +941,16 @@ class PlayerView {
941941
$('.custom-menu').hide(100);
942942
});
943943

944+
window.document.body.style.pointerEvents = 'none';
944945
playerModel.subscribe(this);
945946
}
946947

947948
onPlayerUpdate(model) {
949+
if (!this._latestDrawnImage && model.image) {
950+
window.document.body.style.pointerEvents = '';
951+
window.cvat.frozen = false;
952+
}
953+
948954
const { image } = model;
949955
const { frames } = model;
950956
const { geometry } = model;

0 commit comments

Comments
 (0)