fix sketch hover latch. add pattern warning if no anchor point selected

This commit is contained in:
Stewart Allen 2026-03-10 23:49:30 -04:00
commit 9433cbf09a
3 changed files with 31 additions and 4 deletions

View file

@ -310,6 +310,9 @@ const interact = {
}
}, () => {
this.handleHover();
if (this.isSketchEditing()) {
this.handleSketchHover(null, []);
}
});
space.mouse.onDrag((delta, offset, isDone, intersections) => {

View file

@ -343,8 +343,7 @@ function handleSketchMouseUp(event, intersections) {
const upHit = this.resolveSketchHit(event, intersections, feature);
const hit = upHit
|| (pointerDown?.hitId ? { id: pointerDown.hitId, type: pointerDown?.hitType || null } : null)
|| (pointerDown?.hoveredHitId ? { id: pointerDown.hoveredHitId, type: pointerDown?.hoveredHitType || null } : null)
|| (this.hoveredSketchEntityId ? { id: this.hoveredSketchEntityId } : null);
|| (pointerDown?.hoveredHitId ? { id: pointerDown.hoveredHitId, type: pointerDown?.hoveredHitType || null } : null);
if (hit?.id) {
if (dist > SKETCH_DRAG_START_PX && pointerDown?.hitId) {
// Intended drag gesture that failed to initialize; do not toggle select on mouse-up.

View file

@ -173,7 +173,10 @@ function startSketchCircularPatternMode() {
const feature = this.getEditingSketchFeature();
if (!feature) return false;
const centerRef = this.getSelectedSketchPatternCenter(feature);
if (!centerRef) return false;
if (!centerRef) {
window.alert('Circular pattern requires exactly one anchor point selected.');
return false;
}
this.sketchCircularPatternMode = true;
this.sketchCircularPatternCenterRef = centerRef;
this.stopSketchMirrorMode?.();
@ -206,7 +209,29 @@ function startSketchGridPatternMode() {
const feature = this.getEditingSketchFeature();
if (!feature) return false;
const centerPointId = this.getSelectedSketchGridAnchor(feature);
if (!centerPointId) return false;
if (!centerPointId) {
window.alert('Grid pattern requires exactly one anchor point selected.');
return false;
}
// If line/arc sources are already selected, apply immediately.
const entities = Array.isArray(feature?.entities) ? feature.entities : [];
const byId = new Map(entities.filter(entity => entity?.id).map(entity => [entity.id, entity]));
const sourceIds = Array.from(this.selectedSketchEntities || [])
.filter(id => typeof id === 'string' && id && id !== centerPointId && !id.startsWith('arc-center:'))
.filter(id => {
const ent = byId.get(id);
return ent?.type === 'line' || ent?.type === 'arc';
});
if (sourceIds.length) {
const applied = this.gridPatternSelectedSketchGeometry?.({
centerRef: centerPointId,
sourceIds,
keepResultSelected: false
});
if (applied) return true;
}
this.sketchGridPatternMode = true;
this.sketchGridPatternCenterRef = centerPointId;
this.stopSketchMirrorMode?.();