fix sketch hover latch. add pattern warning if no anchor point selected
This commit is contained in:
parent
86085b9df2
commit
9433cbf09a
3 changed files with 31 additions and 4 deletions
|
|
@ -310,6 +310,9 @@ const interact = {
|
||||||
}
|
}
|
||||||
}, () => {
|
}, () => {
|
||||||
this.handleHover();
|
this.handleHover();
|
||||||
|
if (this.isSketchEditing()) {
|
||||||
|
this.handleSketchHover(null, []);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
space.mouse.onDrag((delta, offset, isDone, intersections) => {
|
space.mouse.onDrag((delta, offset, isDone, intersections) => {
|
||||||
|
|
|
||||||
|
|
@ -343,8 +343,7 @@ function handleSketchMouseUp(event, intersections) {
|
||||||
const upHit = this.resolveSketchHit(event, intersections, feature);
|
const upHit = this.resolveSketchHit(event, intersections, feature);
|
||||||
const hit = upHit
|
const hit = upHit
|
||||||
|| (pointerDown?.hitId ? { id: pointerDown.hitId, type: pointerDown?.hitType || null } : null)
|
|| (pointerDown?.hitId ? { id: pointerDown.hitId, type: pointerDown?.hitType || null } : null)
|
||||||
|| (pointerDown?.hoveredHitId ? { id: pointerDown.hoveredHitId, type: pointerDown?.hoveredHitType || null } : null)
|
|| (pointerDown?.hoveredHitId ? { id: pointerDown.hoveredHitId, type: pointerDown?.hoveredHitType || null } : null);
|
||||||
|| (this.hoveredSketchEntityId ? { id: this.hoveredSketchEntityId } : null);
|
|
||||||
if (hit?.id) {
|
if (hit?.id) {
|
||||||
if (dist > SKETCH_DRAG_START_PX && pointerDown?.hitId) {
|
if (dist > SKETCH_DRAG_START_PX && pointerDown?.hitId) {
|
||||||
// Intended drag gesture that failed to initialize; do not toggle select on mouse-up.
|
// Intended drag gesture that failed to initialize; do not toggle select on mouse-up.
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,10 @@ function startSketchCircularPatternMode() {
|
||||||
const feature = this.getEditingSketchFeature();
|
const feature = this.getEditingSketchFeature();
|
||||||
if (!feature) return false;
|
if (!feature) return false;
|
||||||
const centerRef = this.getSelectedSketchPatternCenter(feature);
|
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.sketchCircularPatternMode = true;
|
||||||
this.sketchCircularPatternCenterRef = centerRef;
|
this.sketchCircularPatternCenterRef = centerRef;
|
||||||
this.stopSketchMirrorMode?.();
|
this.stopSketchMirrorMode?.();
|
||||||
|
|
@ -206,7 +209,29 @@ function startSketchGridPatternMode() {
|
||||||
const feature = this.getEditingSketchFeature();
|
const feature = this.getEditingSketchFeature();
|
||||||
if (!feature) return false;
|
if (!feature) return false;
|
||||||
const centerPointId = this.getSelectedSketchGridAnchor(feature);
|
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.sketchGridPatternMode = true;
|
||||||
this.sketchGridPatternCenterRef = centerPointId;
|
this.sketchGridPatternCenterRef = centerPointId;
|
||||||
this.stopSketchMirrorMode?.();
|
this.stopSketchMirrorMode?.();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue