Change perpendicular-distance constraint to something more intuitive to setting parallel distance (#110)
* some clean up * Change perpendicular-distance constraint to something more intuitive to setting parallel distance * delete * add back * force rename * change name back * try renaming again
This commit is contained in:
@ -11,7 +11,10 @@ import { InternalFn } from './stdTypes'
|
||||
export function getSketchSegmentFromSourceRange(
|
||||
sketchGroup: SketchGroup,
|
||||
[rangeStart, rangeEnd]: SourceRange
|
||||
): SketchGroup['value'][number] {
|
||||
): {
|
||||
segment: SketchGroup['value'][number]
|
||||
index: number
|
||||
} {
|
||||
const startSourceRange = sketchGroup.start?.__geoMeta.sourceRange
|
||||
if (
|
||||
startSourceRange &&
|
||||
@ -19,14 +22,18 @@ export function getSketchSegmentFromSourceRange(
|
||||
startSourceRange[1] >= rangeEnd &&
|
||||
sketchGroup.start
|
||||
)
|
||||
return sketchGroup.start
|
||||
return { segment: sketchGroup.start, index: -1 }
|
||||
|
||||
const line = sketchGroup.value.find(
|
||||
const lineIndex = sketchGroup.value.findIndex(
|
||||
({ __geoMeta: { sourceRange } }) =>
|
||||
sourceRange[0] <= rangeStart && sourceRange[1] >= rangeEnd
|
||||
)
|
||||
const line = sketchGroup.value[lineIndex]
|
||||
if (!line) throw new Error('could not find matching line')
|
||||
return line
|
||||
return {
|
||||
segment: line,
|
||||
index: lineIndex,
|
||||
}
|
||||
}
|
||||
|
||||
export const segLen: InternalFn = (
|
||||
|
Reference in New Issue
Block a user