From cb5050d0288135fecf8cd26a31ad0a8046f30cec Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 13 Nov 2016 19:05:27 +0200 Subject: [PATCH] fixed mask editing when no streaming resolution is available --- motioneye/static/js/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js index 134e7af..e551f62 100644 --- a/motioneye/static/js/main.js +++ b/motioneye/static/js/main.js @@ -908,11 +908,11 @@ function initUI() { $('div#editMaskButton').click(function () { var cameraId = $('#cameraSelect').val(); var img = getCameraFrame(cameraId).find('img.camera')[0]; - if (!img.naturalWidth || !img.naturalHeight) { + if (!img._naturalWidth || !img._naturalHeight) { return runAlertDialog('Cannot edit the mask without a valid camera image!'); } - enableMaskEdit(cameraId, img.naturalWidth, img.naturalHeight); + enableMaskEdit(cameraId, img._naturalWidth, img._naturalHeight); }); $('div#saveMaskButton').click(function () { disableMaskEdit(); @@ -4545,6 +4545,12 @@ function addCameraFrameUi(cameraConfig) { } this.loading = 0; + if (this.naturalWidth) { + this._naturalWidth = this.naturalWidth; + } + if (this.naturalHeight) { + this._naturalHeight = this.naturalHeight; + } if (this.initializing) { cameraProgress.removeClass('visible'); -- 2.39.5