diff --git a/parts/static/script.js b/parts/static/script.js index 94da536..f120cbd 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -270,3 +270,23 @@ $(document).ready(function() { perform_query(); }); }); + +$(document).ready(function() { + $("#clickablemap").on("click", function(event) { + var $img = $(this); + var currentClickPosX = event.pageX - $img.offset().left; + var currentClickPosY = event.pageY - $img.offset().top; + + var currentWidth = $img.width(); + var currentHeight = $img.height(); + + var naturalWidth = this.naturalWidth; + var naturalHeight = this.naturalHeight; + + var correctX = ((naturalWidth / currentWidth) * currentClickPosX).toFixed(0); + var correctY = ((naturalHeight / currentHeight) * currentClickPosY).toFixed(0); + + $("#mapURL").html("elab.png?x=" + correctX + "&y=" + correctY); + $("#clickablemap").attr("src", "http://127.0.0.1:5000/parts/map/elab.png?x=" + correctX + "&y=" + correctY); + }); +}); \ No newline at end of file diff --git a/parts/test.html b/parts/test.html new file mode 100644 index 0000000..d185757 --- /dev/null +++ b/parts/test.html @@ -0,0 +1,20 @@ + + +
+ +