Skip to content

Commit

Permalink
docs(#4): 📝 change name of two functions
Browse files Browse the repository at this point in the history
  • Loading branch information
franmagn committed Oct 23, 2025
1 parent fa8725e commit 6f45475
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/AnnotationControl/annotationPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ export function initAnnotationsPanel(viewer) {
input.focus()
input.select()

function finish(commit) {
function finishInlineEditForUUID(commit) {
const newText = commit ? input.value.trim() || oldText : oldText
// restore label
const newLabel = document.createElement('span')
Expand Down Expand Up @@ -694,12 +694,12 @@ export function initAnnotationsPanel(viewer) {
_commitEditedName(uuid, newText)
}

input.addEventListener('blur', () => finish(true))
input.addEventListener('blur', () => finishInlineEditForUUID(true))
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
finish(true)
finishInlineEditForUUID(true)
} else if (e.key === 'Escape') {
finish(false)
finishInlineEditForUUID(false)
}
})
}
Expand Down Expand Up @@ -750,7 +750,7 @@ export function initAnnotationsPanel(viewer) {
*
* @param {boolean} commit - true to save, false to cancel
*/
function finish(commit) {
function finishInlineDescriptionEdit(commit) {
const newText = commit ? ta.value.trim() || '' : oldText
const displayText = newText ? newText : 'Annotation Description'
const newDesc = document.createElement('div')
Expand Down Expand Up @@ -795,7 +795,7 @@ export function initAnnotationsPanel(viewer) {
_commitEditedDescription(uuid, newText)
}

ta.addEventListener('blur', () => finish(true))
ta.addEventListener('blur', () => finishInlineDescriptionEdit(true))
ta.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
// Shift+Enter: insert newline (allow default). Enter: finish and save.
Expand All @@ -804,9 +804,9 @@ export function initAnnotationsPanel(viewer) {
return
}
e.preventDefault()
finish(true)
finishInlineDescriptionEdit(true)
} else if (e.key === 'Escape') {
finish(false)
finishInlineDescriptionEdit(false)
}
})
}
Expand Down

0 comments on commit 6f45475

Please sign in to comment.