From 6410d355ee18a37e5e342e6010d54081e1e7a868 Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Mon, 8 Jun 2026 17:36:19 -0700 Subject: [PATCH] Add automatic coordinate converstion shortcut Signed-off-by: Justin Georgi --- modules/annot-prev.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/annot-prev.js b/modules/annot-prev.js index 8f9196c..e29ca31 100644 --- a/modules/annot-prev.js +++ b/modules/annot-prev.js @@ -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 == "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]}`) + } + } +}) \ No newline at end of file