Add automatic coordinate converstion shortcut

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2026-06-08 17:36:19 -07:00
parent 5ecb5fa63d
commit 6410d355ee

View File

@@ -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 == "C") {
coordParse = /(\[?)([0-9]+)\s?,\s?([0-9]+)(\]?)/
oldCoord = coordParse.exec(window.getSelection().toString())
if (oldCoord) {
calcX = (oldCoord[2] / 100 * elSvg.width.baseVal.value / elScale).toFixed(1)
calcY = (oldCoord[3] / 100 * elSvg.height.baseVal.value / elScale).toFixed(1)
elInput = document.getElementById('wpTextbox1')
elInput.setRangeText(`${oldCoord[1]}${calcX}, ${calcY}${oldCoord[4]}`)
}
}
})