From 1f974bfbb09f4f8271b53c235ccdadef4355cf41 Mon Sep 17 00:00:00 2001 From: "Amos (LFlare) Ng" Date: Tue, 31 May 2022 15:04:01 +0800 Subject: [PATCH] Visual Selector fix: Firefox compatibility - Visual Selector (#646) --- changedetectionio/static/js/visual-selector.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changedetectionio/static/js/visual-selector.js b/changedetectionio/static/js/visual-selector.js index 0610c47ef..43feccb23 100644 --- a/changedetectionio/static/js/visual-selector.js +++ b/changedetectionio/static/js/visual-selector.js @@ -152,6 +152,13 @@ $(document).ready(function() { ctx.clearRect(0, 0, c.width, c.height); current_selected_i=null; + // Add in offset + if ((typeof e.offsetX === "undefined" || typeof e.offsetY === "undefined") || (e.offsetX === 0 && e.offsetY === 0)) { + var targetOffset = $(e.target).offset(); + e.offsetX = e.pageX - targetOffset.left; + e.offsetY = e.pageY - targetOffset.top; + } + // Reverse order - the most specific one should be deeper/"laster" // Basically, find the most 'deepest' var found=0;