Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5b75185cd | |||
| bb5235727a | |||
| 6410d355ee |
@@ -3,7 +3,7 @@
|
|||||||
"author": "Justin Georgi",
|
"author": "Justin Georgi",
|
||||||
"url": "https://gitea.azgeorgis.net/jgeorgi/AnatImageViewer",
|
"url": "https://gitea.azgeorgis.net/jgeorgi/AnatImageViewer",
|
||||||
"description": "This extension allows the creation of pages in the Annotation namespace which will create annotated images.",
|
"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",
|
"license-name": "MIT",
|
||||||
"type": "media",
|
"type": "media",
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ elSvgCont.addEventListener('auxclick', (e) => {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
if (!e.ctrlKey) {
|
if (!e.ctrlKey) {
|
||||||
elInput = document.getElementById('wpTextbox1')
|
elInput = document.getElementById('wpTextbox1')
|
||||||
elInput.setRangeText(` ${elCoordBox.textContent.replace(',','')}`)
|
elInput.setRangeText(`${(e.altKey ? ' S' : ' ')}${elCoordBox.textContent.replace(',','')}`)
|
||||||
elInput.selectionStart += elCoordBox.textContent.length
|
elInput.selectionStart += elCoordBox.textContent.length + (e.altKey ? 1 : 0)
|
||||||
} else {
|
} else {
|
||||||
navigator.clipboard.writeText(` ${elCoordBox.textContent.replace(',','')}`)
|
navigator.clipboard.writeText(` ${elCoordBox.textContent.replace(',','')}`)
|
||||||
}
|
}
|
||||||
@@ -42,3 +42,15 @@ elSvgCont.addEventListener('mousemove',(e) => {
|
|||||||
elCoordBox.style.left = e.offsetX + 6
|
elCoordBox.style.left = e.offsetX + 6
|
||||||
elCoordBox.style.top = e.offsetY + 12
|
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]}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user