From a5c3cc90244f019cd2eddbe94bf4b75cdceaf7cc Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Mon, 22 Jan 2024 17:06:49 +0000 Subject: [PATCH] #3237 Ensure the ROI editor uses the correct image --- html/includes/moduleutil.php | 2 ++ html/js/jquery-roi/jquery-roi.js | 4 +++- html/js/modules/modules.js | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/html/includes/moduleutil.php b/html/includes/moduleutil.php index ef086afb6..538ff732a 100644 --- a/html/includes/moduleutil.php +++ b/html/includes/moduleutil.php @@ -188,6 +188,8 @@ public function getModuleBaseData() { $result['lat'] = $lat; $result['lon'] = $lon; + $imageDir = get_variable(ALLSKY_CONFIG . '/config.sh', 'IMG_DIR=', 'current/tmp'); + $result['filename'] = $imageDir . '/' . $settings_array['filename']; exec("sunwait poll exit set angle $angle $lat $lon", $return, $retval); if ($retval == 2) { diff --git a/html/js/jquery-roi/jquery-roi.js b/html/js/jquery-roi/jquery-roi.js index f85ba2c14..356bb280b 100644 --- a/html/js/jquery-roi/jquery-roi.js +++ b/html/js/jquery-roi/jquery-roi.js @@ -6,6 +6,7 @@ fallbackValue: 5, dirty: false, roi: null, + imageFile: '', roiSelected: function (roi) { } } @@ -212,7 +213,8 @@ } }; - imageObj.src = 'current/tmp/image.jpg?_ts=1662585950244'; + let srcImage = plugin.settings.imageFile + '?_ts=' + Date.now(); + imageObj.src = srcImage; $('#' + plugin.rioId).modal({ keyboard: false diff --git a/html/js/modules/modules.js b/html/js/modules/modules.js index 8a69dffcf..d198a9710 100644 --- a/html/js/modules/modules.js +++ b/html/js/modules/modules.js @@ -489,10 +489,12 @@ class MODULESEDITOR { if (fallbackValue === undefined) { fallbackValue = 5; } + $.allskyROI({ id: key, roi: roi, fallbackValue: fallbackValue, + imageFile : this.#settings.filename, roiSelected: function(roi) { $('#' + key).val(roi.x1 + ',' + roi.y1 + ',' + roi.x2 + ',' + roi.y2) }