3 Commits

Author SHA1 Message Date
c5b75185cd Bump version
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
2026-06-09 17:19:22 -07:00
bb5235727a Fix conversion regex
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
2026-06-09 17:18:56 -07:00
6410d355ee Add automatic coordinate converstion shortcut
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
2026-06-08 17:36:19 -07:00
2 changed files with 15 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
"author": "Justin Georgi",
"url": "https://gitea.azgeorgis.net/jgeorgi/AnatImageViewer",
"description": "This extension allows the creation of pages in the Annotation namespace which will create annotated images.",
"version": "0.1.0",
"version": "0.1.1",
"license-name": "MIT",
"type": "media",
"manifest_version": 1,

View File

@@ -26,8 +26,8 @@ elSvgCont.addEventListener('auxclick', (e) => {
console.log(e)
if (!e.ctrlKey) {
elInput = document.getElementById('wpTextbox1')
elInput.setRangeText(` ${elCoordBox.textContent.replace(',','')}`)
elInput.selectionStart += elCoordBox.textContent.length
elInput.setRangeText(`${(e.altKey ? ' S' : ' ')}${elCoordBox.textContent.replace(',','')}`)
elInput.selectionStart += elCoordBox.textContent.length + (e.altKey ? 1 : 0)
} else {
navigator.clipboard.writeText(` ${elCoordBox.textContent.replace(',','')}`)
}
@@ -42,3 +42,15 @@ elSvgCont.addEventListener('mousemove',(e) => {
elCoordBox.style.left = e.offsetX + 6
elCoordBox.style.top = e.offsetY + 12
})
document.addEventListener('keydown',(e) => {
if (e.altKey && !e.shiftKey && !e.ctrlKey && e.key == "F3") {
coordParse = /(\[?)([\d\.]+)(,|(?:,\s)|\s)\D*([\d\.]+)(\]?)/
oldCoord = coordParse.exec(window.getSelection().toString())
if (oldCoord) {
calcX = (oldCoord[2] / 100 * elSvg.width.baseVal.value / elScale).toFixed(1)
calcY = (oldCoord[4] / 100 * elSvg.height.baseVal.value / elScale).toFixed(1)
elInput = document.getElementById('wpTextbox1')
elInput.setRangeText(`${oldCoord[1]}${calcX}${oldCoord[3]}${calcY}${oldCoord[5]}`)
}
}
})