Add annotation block with hotkey
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -45,11 +45,6 @@ class AnnotationHooks {
|
|||||||
|
|
||||||
[view]
|
[view]
|
||||||
direction = "L"
|
direction = "L"
|
||||||
|
|
||||||
# [annotation.1]
|
|
||||||
# position =
|
|
||||||
# leader.1 =
|
|
||||||
# light = true
|
|
||||||
NEWAN;
|
NEWAN;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ elSvgCont.addEventListener('click', (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}]`)
|
elInput.setRangeText(`[${elCoordBox.textContent}]`, elInput.selectionStart, elInput.selectionEnd, 'end')
|
||||||
elInput.selectionStart += elCoordBox.textContent.length + 2
|
elInput.focus({ preventScroll: true })
|
||||||
} else {
|
} else {
|
||||||
navigator.clipboard.writeText(`[${elCoordBox.textContent}]`)
|
navigator.clipboard.writeText(`[${elCoordBox.textContent}]`)
|
||||||
}
|
}
|
||||||
@@ -53,4 +53,16 @@ document.addEventListener('keydown',(e) => {
|
|||||||
elInput.setRangeText(`${oldCoord[1]}${calcX}${oldCoord[3]}${calcY}${oldCoord[5]}`)
|
elInput.setRangeText(`${oldCoord[1]}${calcX}${oldCoord[3]}${calcY}${oldCoord[5]}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!e.altKey && e.shiftKey && e.ctrlKey && e.key == "{") {
|
||||||
|
console.log('Add new annotation')
|
||||||
|
const anTemp = `
|
||||||
|
[annotation.#]
|
||||||
|
position =
|
||||||
|
leader.1 =
|
||||||
|
light = true
|
||||||
|
`
|
||||||
|
elInput = document.getElementById('wpTextbox1')
|
||||||
|
elInput.setRangeText(anTemp, elInput.value.length, elInput.value.length, 'start')
|
||||||
|
elInput.focus()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user