diff --git a/app_ui.go b/app_ui.go index f46d7c4..65c7ec7 100644 --- a/app_ui.go +++ b/app_ui.go @@ -3147,7 +3147,7 @@ func (a *app) layoutUI(W, H int) []widget { clipL := rx - sc(4) if U.page == 9 && oeZoom { - clipL, rMax = cx-sc(4), 0 + clipL = cx-sc(4) } if U.rPage != U.page { cancelPanelScroll(a.ctl) @@ -3160,6 +3160,11 @@ func (a *app) layoutUI(W, H int) []widget { U.rScroll = 0 } for i := rLo; i < rHi; i++ { + if U.page == 9 && oeZoom { + g := outlineBigGeometry(cx, top+sc(46), W-pad, logTop-sc(12), sc(1)) + if ws[i].l < g.Controls[0] || ws[i].t < g.Controls[1] { continue } + if ws[i].t-U.rScroll < g.Controls[1] { ws[i].t, ws[i].b = -10000, -10000; continue } + } ws[i].t -= U.rScroll ws[i].b -= U.rScroll } @@ -3588,6 +3593,7 @@ func ctlProc(hwnd uintptr, m uint32, w, l uintptr) uintptr { pInvalidateRect.Call(hwnd, 0, 0) return 0 case 0x0100: + if U.page == 9 && U.keyTyping == 0 && !skDrawing && A.outlineResizeKey351(w) { return 0 } if A.libraryCycleKey315(w, l&(1<<30) != 0) { return 0 } @@ -6871,18 +6877,14 @@ func (a *app) layoutOutlineBig(zl, zt, zr, zb int, add func(widget) int) { if sel >= len(names) { sel = 0 } - bh, rowH := sc(38), sc(36) - by := zb - sc(10) - 6*rowH - cw := zr - zl - 2*sc(16) - cl, ct := zl+sc(16), zt+sc(140) - a.outlineAIWidgets(sel, cl, zt+sc(40), zl+cw+sc(16), add) - chh := by - sc(26) - ct - if chh < sc(100) { - chh = sc(100) - } + bh, rowH := sc(32), sc(38) + g := outlineBigGeometry(zl, zt, zr, zb, sc(1)) + cl, ct, cw, chh := g.Canvas[0], g.Canvas[1], g.Canvas[2], g.Canvas[3] skSetRect(cl, ct, cl+cw, ct+chh) skImg := a.skFrame(cw, chh) add(widget{kind: kThumb, id: idOeCanvas, l: cl, t: ct, r: cl + cw, b: ct + chh + sc(24), img: skImg, text: a.skCaptionWithMarks(skImg)}) + // Controls have their own column. They never cover the photo or its hit box. + cl, cw, by := g.Controls[0], g.Controls[2], g.Controls[1] clsIdx := 0 a.pl.mu.Lock() if sel >= 0 && sel < len(a.pl.P.Surfaces) { @@ -6894,60 +6896,28 @@ func (a *app) layoutOutlineBig(zl, zt, zr, zb int, add func(widget) int) { } muted := sel >= 0 && sel < len(a.pl.P.Surfaces) && a.pl.P.Surfaces[sel].Muted a.pl.mu.Unlock() - hw2 := (cw - sc(8)) / 2 - qw := (cw - 3*sc(8)) / 4 - tw3 := (cw - 2*sc(8)) / 3 - type bb struct { - id int - t string - } - add(widget{kind: kDrop, id: idOeSurf, l: cl, t: by, r: cl + hw2, b: by + bh, items: names, sel: sel}) - add(widget{kind: kDrop, id: idOeCls, l: cl + hw2 + sc(8), t: by, r: cl + 2*hw2 + sc(8), b: by + bh, items: skClasses, sel: clsIdx}) - for i, b := range []bb{{idOeAdd, "Add a point"}, {idOeDel, "Remove selected point"}, {idOeBig, "Bigger"}, {idOeSmall, "Smaller"}} { - add(widget{kind: kBtn, id: b.id, text: b.t, l: cl + i*(qw+sc(8)), t: by + rowH, r: cl + i*(qw+sc(8)) + qw, b: by + rowH + bh, style: stNormal, enabled: true}) - } - for i, b := range []bb{{idOeRotL, "Rotate left 15°"}, {idOeRotR, "Rotate right 15°"}, {idOeCopy, "Copy this shape"}, {idOePaste, "Paste shape here"}} { - add(widget{kind: kBtn, id: b.id, text: b.t, l: cl + i*(qw+sc(8)), t: by + 2*rowH, r: cl + i*(qw+sc(8)) + qw, b: by + 2*rowH + bh, style: stNormal, enabled: true}) - } - add(widget{kind: kBtn, id: idOeReset, text: "Reset this outline to its box", l: cl, t: by + 3*rowH, r: cl + tw3, b: by + 3*rowH + bh, style: stNormal, enabled: true}) - add(widget{kind: kToggle, id: idOeMute, text: "Mute this outline tonight (projects black)", l: cl + tw3 + sc(8), t: by + 3*rowH + sc(5), r: cl + 2*tw3 + sc(8), b: by + 3*rowH + sc(5) + sc(26), on: muted, enabled: true}) - add(widget{kind: kBtn, id: idOeZoom, text: "Back to normal view", l: cl + 2*(tw3+sc(8)), t: by + 3*rowH, r: cl + 2*(tw3+sc(8)) + tw3, b: by + 3*rowH + bh, style: stPrimary, enabled: true}) - if skDrawing { - add(widget{kind: kBtn, id: idOeCancelDraw, text: "Cancel new shape", l: cl, t: by + 4*rowH, r: cl + tw3, b: by + 4*rowH + bh, enabled: true}) - } else { - add(widget{kind: kBtn, id: idOeDelShape, text: "Delete this shape (cannot be undone)", l: cl, t: by + 4*rowH, r: cl + tw3, b: by + 4*rowH + bh, style: stDanger, enabled: true}) - } - dr := "Draw a new shape on the photo" - if skDrawing { - dr = fmt.Sprintf("Finish shape (%d points - needs 3)", len(skDrawPts)) - } - add(widget{kind: kBtn, id: idOeNewShape, text: dr, l: cl + tw3 + sc(8), t: by + 4*rowH, r: cl + 2*tw3 + sc(8), b: by + 4*rowH + bh, style: stNormal, enabled: true}) - la2 := "Magic lasso (SAM)" - if skLassoArmed { - la2 = "Lasso: click object (cancel)" - } - add(widget{kind: kBtn, id: idOeLasso, text: la2, l: cl + 2*(tw3+sc(8)), t: by + 4*rowH, r: cl + 3*tw3 + 2*sc(8), b: by + 4*rowH + bh, style: stNormal, enabled: true}) - focusOn := false - a.pl.mu.Lock() - if sel >= 0 && sel < len(a.pl.P.Surfaces) { - focusOn = a.pl.R.FocusID() == a.pl.P.Surfaces[sel].ID - } - a.pl.mu.Unlock() - playOn := false - a.pl.mu.Lock() - if sel >= 0 && sel < len(a.pl.P.Surfaces) { - playOn = a.pl.R.FocusAnimID() == a.pl.P.Surfaces[sel].ID - } - a.pl.mu.Unlock() - add(widget{kind: kToggle, id: idOeFocus, text: "Focus: light ONLY this outline white", l: cl, t: by + 5*rowH + sc(5), r: cl + tw3, b: by + 5*rowH + sc(5) + sc(26), on: focusOn, enabled: true}) - add(widget{kind: kToggle, id: idOeLiveBg, text: "Live webcam background", l: cl + tw3 + sc(8), t: by + 5*rowH + sc(5), r: cl + 2*tw3 + sc(8), b: by + 5*rowH + sc(5) + sc(26), on: skLiveBg.Load(), enabled: true}) - add(widget{kind: kToggle, id: idOePlayShape, text: "Play its animation on this outline only", l: cl + 2*(tw3+sc(8)), t: by + 5*rowH + sc(5), r: cl + 3*tw3 + 2*sc(8), b: by + 5*rowH + sc(5) + sc(26), on: playOn, enabled: true}) + half := (cw-sc(8))/2 + add(widget{kind:kDrop,id:idOeSurf,l:cl,t:by,r:cl+cw,b:by+bh,items:names,sel:sel}) + add(widget{kind:kDrop,id:idOeCls,l:cl,t:by+rowH,r:cl+cw,b:by+rowH+bh,items:skClasses,sel:clsIdx}) + type ob struct{id int; text string; style int} + // Primary controls stay at the top at laptop heights. Never shrink long labels to quarter-width buttons. + controls:=[]ob{{idOeBig,"Bigger (+)",stNormal},{idOeSmall,"Smaller (-)",stNormal},{idOeRotL,"Rotate left 15°",stNormal},{idOeRotR,"Rotate right 15°",stNormal},{idOeCopy,"Copy shape",stNormal},{idOePaste,"Paste shape",stNormal},{idOeAdd,"Add point",stNormal},{idOeDel,"Remove point",stNormal},{idOeReset,"Reset to box",stNormal},{idOeZoom,"Normal view",stPrimary}} + for i,b:=range controls { x,y:=cl+(i%2)*(half+sc(8)),by+(2+i/2)*rowH;add(widget{kind:kBtn,id:b.id,text:b.text,l:x,t:y,r:x+half,b:y+bh,style:b.style,enabled:true}) } + focusOn,playOn:=false,false + a.pl.mu.Lock() + if sel>=0&&sel width*2/5 { + controls = width * 2 / 5 + } + canvasW := width - controls - gap + height := b - innerT - 36*scale + if height < 1 { + height = 1 + } + if canvasW < 1 { + canvasW = 1 + } + return outlineBigRegions{Canvas: [4]int{innerL, innerT, canvasW, height}, Controls: [4]int{innerL + canvasW + gap, innerT, controls, height}} +} diff --git a/outline_big_geometry_test.go b/outline_big_geometry_test.go new file mode 100644 index 0000000..4116da0 --- /dev/null +++ b/outline_big_geometry_test.go @@ -0,0 +1,16 @@ +package main + +import "testing" + +func Test351BigCanvasDoesNotOverlapControls(t *testing.T) { + for _, v := range [][5]int{{230, 150, 1264, 630, 1}, {230, 170, 1350, 680, 1}, {230, 130, 1008, 550, 1}, {300, 200, 1900, 900, 1}} { + g := outlineBigGeometry(v[0], v[1], v[2], v[3], v[4]) + c, k := g.Canvas, g.Controls + if c[2] < 400 || c[3] < 200 { + t.Fatalf("canvas unusable: %v %v", v, g) + } + if c[0]+c[2] >= k[0] || c[1]+c[3]+24 > v[3] { + t.Fatalf("overlap/outofbounds: %v", g) + } + } +} diff --git a/outline_resize351.go b/outline_resize351.go new file mode 100644 index 0000000..c6f23f7 --- /dev/null +++ b/outline_resize351.go @@ -0,0 +1,11 @@ +package main + +func outlineResizeFactor351(key uintptr) float64 { + switch key { + case 0xBB, 0x6B: + return 1.06 + case 0xBD, 0x6D: + return 1 / 1.06 + } + return 0 +} diff --git a/outline_resize351_core_test.go b/outline_resize351_core_test.go new file mode 100644 index 0000000..b35c14a --- /dev/null +++ b/outline_resize351_core_test.go @@ -0,0 +1,28 @@ +package main + +import ( + "math" + "testing" +) + +func Test351PickThenResizeOnlySelected(t *testing.T) { + s := newSkSession() + a := []skSurf{{ID: "a", Poly: [][2]float64{{.1, .1}, {.3, .1}, {.3, .3}, {.1, .3}}}, {ID: "b", Poly: [][2]float64{{.5, .5}, {.7, .5}, {.7, .7}, {.5, .7}}}} + before := append([][2]float64(nil), a[0].Poly...) + s.Pick(1) + if !s.Scale(a, outlineResizeFactor351(0xBB)) { + t.Fatal("no resize") + } + for i, p := range before { + if a[0].Poly[i] != p { + t.Fatal("unselected modified") + } + } + if math.Abs(a[1].Poly[0][0]-.494) > 1e-9 { + t.Fatal(a[1].Poly) + } + s.Scale(a, outlineResizeFactor351(0xBD)) + if math.Abs(a[1].Poly[0][0]-.5) > 1e-9 { + t.Fatal("roundtrip", a[1].Poly) + } +} diff --git a/outline_resize351_test.go b/outline_resize351_test.go new file mode 100644 index 0000000..2cdcd25 --- /dev/null +++ b/outline_resize351_test.go @@ -0,0 +1,21 @@ +package main + +import "testing" + +func Test351ResizeKeys(t *testing.T) { + for _, k := range []uintptr{0xBB, 0x6B} { + if outlineResizeFactor351(k) != 1.06 { + t.Fatal(k) + } + } + for _, k := range []uintptr{0xBD, 0x6D} { + if outlineResizeFactor351(k) != 1/1.06 { + t.Fatal(k) + } + } + for _, k := range []uintptr{'A', 0x25, 0x30} { + if outlineResizeFactor351(k) != 0 { + t.Fatal(k) + } + } +} diff --git a/outline_resize351_windows.go b/outline_resize351_windows.go new file mode 100644 index 0000000..fb7fc30 --- /dev/null +++ b/outline_resize351_windows.go @@ -0,0 +1,28 @@ +//go:build windows + +package main + +// Only callers owning a preview/editor keyboard focus may use this shortcut. +func (a *app) outlineResizeKey351(key uintptr) bool { + f := outlineResizeFactor351(key) + if f == 0 || skDrawing || skS.Active() { + return false + } + if ctrl, _, _ := pGetKeyState.Call(0x11); ctrl&0x8000 != 0 { + return false + } + if alt, _, _ := pGetKeyState.Call(0x12); alt&0x8000 != 0 { + return false + } + a.pl.mu.Lock() + valid := skS.Sel >= 0 && skS.Sel < len(a.pl.P.Surfaces) + a.pl.mu.Unlock() + if !valid { + return false + } + a.skScale(f) + a.relayout(a.ctl) + pInvalidateRect.Call(a.ctl, 0, 0) + pInvalidateRect.Call(a.prev, 0, 0) + return true +} diff --git a/whatsnew_ui_win.go b/whatsnew_ui_win.go index 6ae146b..3b9dacc 100644 --- a/whatsnew_ui_win.go +++ b/whatsnew_ui_win.go @@ -47,6 +47,7 @@ type whatsNewFeature struct { } var whatsNewFeatures = []whatsNewFeature{ + {"351: Guided calibration handoff and usable outline canvas", "Experimental. Full Windows app and real camera/projector tests NOT RUN. Dual-webcam first-pattern timeout remains unresolved.", []string{"Guided Auto now creates and accepts its own fresh detected project before dot measurement, instead of silently adding to the old scene and stopping before calibration.", "Guided detection respects the Indoor/Outside setting from the first attempt. It no longer tries house detection first in an indoor room.", "The BIG VIEW outline photo and editing controls use separate columns, with object/type selection and Bigger/Smaller at the top.", "Click an outline in Live preview to select it; + and - resize it. Right-click keeps the existing type menu. Webcam-only preview stays pan/zoom because it is not registered to the saved outline photo.", "Dual-webcam timeout messages retain the last capture failure instead of discarding it; the hardware failure is not claimed fixed."}, []string{"Run Guided Auto once with the correct Indoor/Outside setting and send logs after it completes or stops. Do not treat the map as accurate until its measured check passes. No claim of physical alignment from software tests."}, ""}, {"350: Reviewed Antigravity floral and finite-input fixes", "Experimental. Native Windows, projector, audio and real-room tests NOT RUN.", []string{"Precomputed smooth mesh normals and 640x360 panels; up to12flowers across the first24authored contours, max3per shape, including sideways/diagonal artistic fitting. Fair allocation does not fill every object when more than12are fittable.", "Final mask uses a conservative interior guard. Projection sampling stays nearest-neighbor, not contributor bilinear filtering, to preserve exact black edges. No scan, live room tracking or camera-to-photo registration added.", "Floral state pointer avoids copying its mutex in audit snapshots. Finite UV/intensity guards added to shared GPU-frame sampling, Botanical, Chimera and Kiro. Chimera room-photo albedo interpolation improved. Seven formerly static Christmas shaders now animate; effect browser categories expanded. Unqualified AG100 parallelization and rejected343/345/Nexus lineages excluded."}, []string{"Use a project copy. Check narrow vertical/horizontal/diagonal objects, Stop/Blackout and frame profiler. Local CPU harness about10.7ms ordinary and28.0ms worst12contours per prepared panel, not rigFPS. 349 and347 retained."}, ""}, {"349: Floral meshes fit authored object shapes", "Experimental low-poly floral art. Native Windows/projector/real-room NOT RUN.", []string{"Sandflow flowers now fit actual authored polygon interiors. Mesh vertices are scaled before drawing; exact polygon clipping is a final guard. Up to3blooms per receiver, scanning at most12authored objects. More objects may remain unfilled.", "Geometry masks are cached and rebuilt when outlines change. Missing outlines show a declared panel garden; invalid or unfittable authored outlines stay black. No new scan, camera input, registration or physical-room acceptance.", "Includes held348 contour sampling, bounded stem bending, separate petal ripple and480x270prepared panels. Sandflow CC BY4.0 attribution retained. Low-poly art, not cinematic model inference."}, []string{"Test on a project copy with your real authored object outlines. Compare tall, wide and concave shapes, change the contour, then Stop.347 rollback retained."}, ""},