Closed darwinjob closed 3 years ago
Ha! I got it figured! For noobs like I'm here's very short and simple code, requires no extra libraries: svg_overlay.txt
There's something wrong with the Github code formatter so I had to place the code as the attachment.
I'm glad you got it figured out! BTW, to format multiple lines of code in a GitHub comment, use ``` on its own line before and after your code block. I've updated your original post to use that.
BTW, to format multiple lines of code in a GitHub comment, use ``` on its own line before and after your code block.
Even better, before the code block use “```javascript” without the quotes for syntax highlighting! ;)
<div id="openseadragon1" />
<script src="openseadragon.min.js"></script>
<script type="text/javascript">
var viewer = OpenSeadragon({
id: "openseadragon1",
prefixUrl: "images/",
tileSources: "pyramid.dzi"
});
var svg_overlay = document.createElement("div");
svg_overlay.id = "svg-overlay";
viewer.addOverlay({
element: svg_overlay,
location: new OpenSeadragon.Rect(0, 0, 1, 1)
});
fetch("annotation.svg")
.then(r => r.text())
.then(text => svg_overlay.innerHTML = text);
</script>
Lovely :)
Hi I'm new to all this. I read thru the issues but I don't get how i can put my SVG on top of OSD image without doing all these manipulations. Am I missing something? Here's SVG file (fetched as text, the coordinates are the image coordinates obviously):