Skip to content

Commit e92bc62

Browse files
committed
checkpoint boundary selection work
1 parent a0a9c6c commit e92bc62

2 files changed

Lines changed: 22 additions & 19 deletions

File tree

src/void/sketch/pointer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,17 @@ function handleSketchHover(event, intersections) {
254254

255255
const hit = this.resolveSketchHit(event, intersections, feature);
256256
const hasIntersections = Array.isArray(intersections) && intersections.length > 0;
257-
const derived = hasIntersections
257+
let derived = hasIntersections
258258
? this.resolveDerivedEdgeCandidate(event, intersections, feature)
259259
: (this.hoveredDerivedCandidate || null);
260+
if (hit?.id) {
261+
// Current sketch entities take priority over any behind-surface derive targets.
262+
derived = null;
263+
if (this.hoveredSolidFaceKey) {
264+
this.hoveredSolidFaceKey = null;
265+
api.solids?.setHoveredFace?.(null);
266+
}
267+
}
260268
if (this.hoveredSolidFaceKey) {
261269
// In sketch mode boundary/projection previews replace solid-face fill hover.
262270
api.solids?.setHoveredFace?.(null);

src/void/sketch/tools.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -434,25 +434,17 @@ function useHoveredDerivedEdge() {
434434
const selectedFaces = Array.from(this.selectedSolidFaceKeys || []);
435435
const hovered = this.hoveredDerivedCandidate || null;
436436
if (!selectedEdges.length && !selectedPoints.length && !selectedFaces.length) {
437-
// Prefer hovered face derive over implicit edge derive when nothing is
438-
// explicitly selected. This keeps `u` on face interiors intuitive.
439-
if (this.hoveredSolidFaceKey) {
437+
// `u` should prioritize the actively hovered derived edge candidate.
438+
if (hovered?.aLocal && hovered?.bLocal) {
439+
selectedEdges.push({
440+
type: 'edge',
441+
aLocal: hovered.aLocal,
442+
bLocal: hovered.bLocal,
443+
source: hovered.source || null
444+
});
445+
} else if (this.hoveredSolidFaceKey) {
446+
// Face derive is fallback only when no discrete edge is hovered.
440447
selectedFaces.push(this.hoveredSolidFaceKey);
441-
} else if (hovered?.aLocal && hovered?.bLocal) {
442-
if (hovered?.hoverPoint?.local && (hovered?.hoverPoint?.kind === 'a' || hovered?.hoverPoint?.kind === 'b' || hovered?.hoverPoint?.kind === 'mid')) {
443-
selectedPoints.push({
444-
type: 'point',
445-
local: hovered.hoverPoint.local,
446-
source: { ...(hovered.source || {}), local_point: null, point_kind: hovered.hoverPoint.kind || 'mid' }
447-
});
448-
} else {
449-
selectedEdges.push({
450-
type: 'edge',
451-
aLocal: hovered.aLocal,
452-
bLocal: hovered.bLocal,
453-
source: hovered.source || null
454-
});
455-
}
456448
}
457449
}
458450
const created = this.deriveSelectionsAtomic(feature, {
@@ -461,6 +453,9 @@ function useHoveredDerivedEdge() {
461453
faces: selectedFaces
462454
});
463455
if (!created) return false;
456+
// Prevent immediate face-boundary re-highlight after `u` when cursor is still nearby.
457+
this.hoveredSolidFaceKey = null;
458+
api.solids?.setHoveredFace?.(null);
464459
this.clearSketchSelection?.();
465460
return true;
466461
}

0 commit comments

Comments
 (0)