function relocateImg(){
let pins = document.getElementsByClassName("doc_pin_image")
// Get the page object
let img = document.getElementById("image_annotation");
// The original page width to calculate relative modifier
const pageOriginalWidth = 905;
// Calculate modifier
let mod = pageOriginalWidth/img.width;
for(let i = 0; i<pins.length; i++){
pin = pins[i];
// Get original pin location
const originalPX = pin.getAttribute("data-x");
const originalPY = pin.getAttribute("data-y");
// Set the location of the pin to be relative to the page's size
pin.style.left = originalPY/mod+"px"
pin.style.top = originalPX/mod+"px"
}
}
Comments