MCPcopy Create free account
hub / github.com/SplootCode/splootcode / handleClick

Method handleClick

packages/editor/src/context/selection.ts:876–900  ·  view source on GitHub ↗
(x: number, y: number, shiftKey: boolean)

Source from the content-addressed store, hash-verified

874 }
875
876 handleClick(x: number, y: number, shiftKey: boolean) {
877 const [cursor, isCursor] = this.cursorMap.getCursorPositionByCoordinate(x, y)
878 this.lastYCoordinate = y
879 this.lastXCoordinate = x
880
881 if (shiftKey) {
882 const cursorAtStart =
883 this.cursor &&
884 (this.cursor.lineIndex > cursor.lineIndex
885 ? true
886 : this.cursor.lineIndex === cursor.lineIndex && this.cursor.entryIndex > cursor.entryIndex)
887 this.startMultiSelect(cursorAtStart)
888 this.updateMultiSelect(cursor, isCursor)
889 } else {
890 if (isCursor) {
891 this.placeCursorPosition(cursor, isCursor, false)
892 } else {
893 if (this.isSelectedNodeAtPosition(cursor)) {
894 this.startEditAtCurrentCursor()
895 } else {
896 this.selectNodeAtPosition(cursor)
897 }
898 }
899 }
900 }
901
902 placeCursorByXYCoordinate(x: number, y: number) {
903 const [cursor, isCursor] = this.cursorMap.getCursorPositionByCoordinate(x, y)

Callers 2

Calls 7

startMultiSelectMethod · 0.95
updateMultiSelectMethod · 0.95
placeCursorPositionMethod · 0.95
selectNodeAtPositionMethod · 0.95

Tested by

no test coverage detected