remove useAppMode hook file (#829)

This commit is contained in:
Kurt Hutten
2023-10-11 15:12:29 +11:00
committed by GitHub
parent d0930477ad
commit 6c15a743a2
5 changed files with 29 additions and 30 deletions

View File

@ -1,27 +0,0 @@
import { Selections } from 'useStore'
import { ArtifactMap, EngineCommandManager } from 'lang/std/engineConnection'
import { isOverlap } from 'lib/utils'
export function isCursorInSketchCommandRange(
artifactMap: ArtifactMap,
selectionRanges: Selections
): string | false {
const overlapingEntries: [string, ArtifactMap[string]][] = Object.entries(
artifactMap
).filter(([id, artifact]: [string, ArtifactMap[string]]) =>
selectionRanges.codeBasedSelections.some(
(selection) =>
Array.isArray(selection?.range) &&
Array.isArray(artifact?.range) &&
isOverlap(selection.range, artifact.range) &&
(artifact.commandType === 'start_path' ||
artifact.commandType === 'extend_path' ||
artifact.commandType === 'close_path')
)
)
return overlapingEntries.length && overlapingEntries[0][1].parentId
? overlapingEntries[0][1].parentId
: overlapingEntries.find(
([, artifact]) => artifact.commandType === 'start_path'
)?.[0] || false
}