profile start constrain overlays (#6795)
* constrain profile start * add test * make sure it works on segment drag too, fix tests * remove old log * some tests fixes * Bump more segment counters * Two more fixes * Two more test fixes * small test fix * moretest fixes * another test --------- Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
This commit is contained in:
@ -26,7 +26,7 @@ import {
|
||||
applyConstraintLength,
|
||||
} from '@src/components/Toolbar/setAngleLength'
|
||||
import {
|
||||
SEGMENT_BODIES,
|
||||
SEGMENT_BODIES_PLUS_PROFILE_START,
|
||||
getParentGroup,
|
||||
} from '@src/clientSideScene/sceneConstants'
|
||||
import { useFileContext } from '@src/hooks/useFileContext'
|
||||
@ -222,14 +222,15 @@ export const ModelingMachineProvider = ({
|
||||
if (event.type !== 'Set mouse state') return {}
|
||||
const nextSegmentHoverMap = () => {
|
||||
if (event.data.type === 'isHovering') {
|
||||
const parent = getParentGroup(event.data.on, SEGMENT_BODIES)
|
||||
const parent = getParentGroup(
|
||||
event.data.on,
|
||||
SEGMENT_BODIES_PLUS_PROFILE_START
|
||||
)
|
||||
const pathToNode = parent?.userData?.pathToNode
|
||||
const pathToNodeString = JSON.stringify(pathToNode)
|
||||
if (!parent || !pathToNode) return context.segmentHoverMap
|
||||
if (context.segmentHoverMap[pathToNodeString] !== undefined)
|
||||
clearTimeout(
|
||||
context.segmentHoverMap[JSON.stringify(pathToNode)]
|
||||
)
|
||||
clearTimeout(context.segmentHoverMap[pathToNodeString])
|
||||
return {
|
||||
...context.segmentHoverMap,
|
||||
[pathToNodeString]: 0,
|
||||
@ -240,7 +241,7 @@ export const ModelingMachineProvider = ({
|
||||
) {
|
||||
const mouseOnParent = getParentGroup(
|
||||
context.mouseState.on,
|
||||
SEGMENT_BODIES
|
||||
SEGMENT_BODIES_PLUS_PROFILE_START
|
||||
)
|
||||
if (!mouseOnParent || !mouseOnParent?.userData?.pathToNode)
|
||||
return context.segmentHoverMap
|
||||
@ -276,10 +277,11 @@ export const ModelingMachineProvider = ({
|
||||
'Set Segment Overlays': assign({
|
||||
segmentOverlays: ({ context: { segmentOverlays }, event }) => {
|
||||
if (event.type !== 'Set Segment Overlays') return {}
|
||||
if (event.data.type === 'set-many')
|
||||
if (event.data.type === 'set-many') {
|
||||
return {
|
||||
...event.data.overlays,
|
||||
}
|
||||
}
|
||||
if (event.data.type === 'set-one')
|
||||
return {
|
||||
...segmentOverlays,
|
||||
|
Reference in New Issue
Block a user