diff --git a/src/overlay.js b/src/overlay.js index 36ea93a1..447e9c67 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -133,12 +133,9 @@ this.elementWrapper.appendChild(this.element); if (this.element.id) { - this.elementWrapper.id = "overlay-wrapper-" + this.element.id; - } else { - this.elementWrapper.id = "overlay-wrapper-" + crypto.randomUUID(); // Ensure unique ID + this.elementWrapper.id = "overlay-wrapper-" + this.element.id; // Unique ID if element has one } - - // Always add a class for easier selection + // Always add a class for styling & selection this.elementWrapper.classList.add("openseadragon-overlay-wrapper"); @@ -502,4 +499,4 @@ } }; -}(OpenSeadragon)); +}(OpenSeadragon)); \ No newline at end of file