MCPcopy
hub / github.com/ZToolsCenter/ZTools / handleListKeydown

Function handleListKeydown

resources/preload.js:1613–1641  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1611 }
1612
1613 function handleListKeydown(e) {
1614 if (!listState.active) return
1615 var maxIdx = listState.items.length - 1
1616 if (maxIdx < 0) return
1617 if (e.key === 'ArrowUp' || e.key === 'Up') {
1618 e.preventDefault()
1619 listState.ignoreMouseHover = true
1620 syncMouseHoverState()
1621 if (listState.selectedIndex > 0) {
1622 listState.selectedIndex--
1623 } else {
1624 listState.selectedIndex = maxIdx
1625 }
1626 updateSelection()
1627 } else if (e.key === 'ArrowDown' || e.key === 'Down') {
1628 e.preventDefault()
1629 listState.ignoreMouseHover = true
1630 syncMouseHoverState()
1631 if (listState.selectedIndex < maxIdx) {
1632 listState.selectedIndex++
1633 } else {
1634 listState.selectedIndex = 0
1635 }
1636 updateSelection()
1637 } else if (e.key === 'Enter' || e.key === 'Return') {
1638 e.preventDefault()
1639 doSelect()
1640 }
1641 }
1642
1643 electron.ipcRenderer.on('activate-list-mode', function (event, data) {
1644 var featureCode = data.featureCode

Callers

nothing calls this directly

Calls 3

syncMouseHoverStateFunction · 0.85
updateSelectionFunction · 0.85
doSelectFunction · 0.85

Tested by

no test coverage detected