Fix display of selection ring

This commit is contained in:
Christoph Hagen 2022-12-16 21:35:26 +01:00
parent 148c6e00ca
commit b985cf3a33

View File

@ -24,8 +24,7 @@ function getCapIdAtPosition(position) {
return capPositions[position];
}
const selectedCapCircle = document.querySelector("#selected-cap-circle");
const imageCanvas = document.querySelector("#image-canvas");
const imageCanvas = document.getElementById("image-canvas");
var capPositions = Array.from(
{length: numberOfCaps},
@ -37,6 +36,7 @@ imageCanvas.innerHTML += capPositions.map(createImage).join("");
var selectedPosition = null;
const elements = imageCanvas.getElementsByTagName("img");
const selectedCapCircle = document.getElementById("selected-cap-circle");
imageCanvas.addEventListener("click", function(event) {
const xPosition = event.clientX - imageCanvas.getBoundingClientRect().left;