Phones: Extrude from a sketch can take several regions again. A tapped region opens Extrude straight away (arrow at 0), which left no way to add a second one (a hex head with a circle drawn in it came out with a hole); now, while the arrow is still at 0, tapping another region of the same sketch adds it, tapping it again takes it out, with a count shown. Found building a screw through the tools on a phone-sized screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,3 +2,4 @@ node_modules/
|
||||
dist/
|
||||
*.log
|
||||
.wrangler/
|
||||
shots/
|
||||
|
||||
+33
-1
@@ -9,7 +9,8 @@ import type { ToolPointer } from "../view/input";
|
||||
import { FeatureOp } from "./featureOp";
|
||||
import { axisDrag, Handle } from "./handles";
|
||||
import { axisSlot, directionSlot, facesSlot, pathSlot, planeSlot, pointSlot, sectionsSlot } from "./slots";
|
||||
import { faceIndexOf, oppositeFace, sourceFrame, targetOf, type AppContext, type Sel } from "./tool";
|
||||
import { faceIndexOf, oppositeFace, sourceFrame, sourcesOf, targetOf, type AppContext, type Sel } from "./tool";
|
||||
import { arrangement, resolveRegion } from "../sketch/regions";
|
||||
import { DimWidget } from "./annotate";
|
||||
import { Gimbal, GIMBAL_AXES, IN_PLANE, SCALE_PARTS, type GimbalPart } from "./gimbal";
|
||||
import { DragTyping } from "./dragTyping";
|
||||
@@ -159,6 +160,37 @@ export class ExtrudeOp extends FeatureOp<ExtrudeFeature> {
|
||||
if (!on) super.hover(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Another region of the same sketch tapped while the arrow is still at 0
|
||||
* (on a phone a tapped region opens Extrude straight away): it joins the
|
||||
* profile — tapped again, it leaves. So several regions go up together.
|
||||
*/
|
||||
tap(p: ToolPointer): void {
|
||||
const src = this.feature.source;
|
||||
if (src.kind === "profile" && this.feature.distance === 0 && !this.existing) {
|
||||
const hit = this.app.view.pick(p.x, p.y, { edgeTolPx: p.tol, profiles: true, planes: false, axes: false, vertices: false });
|
||||
if (hit?.kind === "profile" && hit.sketch === src.sketch) {
|
||||
// The regions it has now (the selection is cleared when Extrude opens).
|
||||
const arr = arrangement(this.app.sketchCurves(src.sketch));
|
||||
const have = src.regions.map((ref) => resolveRegion(arr, ref)).map((r) => (r ? arr.regions.indexOf(r) : -1)).filter((k) => k >= 0);
|
||||
const sel = have.map((region) => ({ kind: "profile" as const, sketch: src.sketch, region }));
|
||||
const i = sel.findIndex((s) => s.region === hit.region);
|
||||
const next = i >= 0 ? sel.filter((_, j) => j !== i) : [...sel, { kind: "profile" as const, sketch: hit.sketch, region: hit.region }];
|
||||
if (!next.length) return void this.app.setTool(null);
|
||||
this.app.setSelection(next);
|
||||
const made = sourcesOf(this.app, next)[0];
|
||||
if (made) {
|
||||
this.feature.source = made;
|
||||
this.frame = sourceFrame(this.app, made);
|
||||
this.app.ui.toast(`${next.length} region${next.length > 1 ? "s" : ""} selected`);
|
||||
this.onDraftChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.tap(p);
|
||||
}
|
||||
|
||||
down(p: ToolPointer): boolean {
|
||||
if (!this.handle.hit(p)) return false;
|
||||
this.dragging = { from: p, d0: this.feature.distance };
|
||||
|
||||
Reference in New Issue
Block a user