Open
Description
Hi,
I think I met an edge which I don't find any solutions yet. I have a gallery where I add the marker object to the presently viewed image when it appears, but the problem here is that, I get lot of markers to be created on top of each other, due to which the ok or cancel button doesn't hide on click on them until the number of time attached gets clicked. Is there anyway we can remove the marker object from the target before we attach it, so that the target always have only one fresh one attached. I have created one demo here https://codesandbox.io/s/marker-js-2-all-defaults-demo-forked-bl5tp0?file=/src/index.js
import "./styles.css";
import * as markerjs2 from "markerjs2";
function showMarkerArea(target) {
const markerArea = new markerjs2.MarkerArea(target);
markerArea.addEventListener(
"render",
(event) => (target.src = event.dataUrl)
);
markerArea.show();
}
const sampleImage = document.getElementById("sampleImage");
sampleImage.addEventListener("click", () => {
// showMarkerArea(sampleImage);
[1, 2, 3].forEach(() => {
showMarkerArea(sampleImage);
});
});
Metadata
Metadata
Assignees
Labels
No labels