app
KiCad - the KiCad Bridge
Public Made by Adomby adom
Reference implementation of the KiCad bridge: multi-instance Python server, forward path via kicad-cli, reverse path via in-process plugin. Most complex of the three bundled bridges.
← Commit history
0.9.339: Tour motion: zoom depth per beat (one step for a single part, two plus one for a sheet or board)
1 file changed
+8−4
handlers/demo_motion.py+8−4@@ -199,7 +199,7 @@ def choreograph_3d_menu(hwnd: int, abort=None, log=None, measure=None) -> dict | return rep -def choreograph(hwnd: int, kind: str, abort=None, log=None, check=None, measure=None, focus=None) -> dict:+def choreograph(hwnd: int, kind: str, abort=None, log=None, check=None, measure=None, focus=None, zoom=(2, 1)) -> dict: """Run the beat's motion on `hwnd`. kind: '2d' | '3d'. Returns a report; never raises. Stops the instant the window is not in front or abort().""" rep = {"kind": kind, "gestures": 0, "aborted": None}@@ -271,14 +271,18 @@ def choreograph(hwnd: int, kind: str, abort=None, log=None, check=None, measure= rep["aim"] = {"x": aim["x"], "y": aim["y"], "bbox": bb, "coverage": m.get("coverage")} except Exception: # pylint: disable=broad-except pass+ # zoom depth per beat (John, 2026-09-05: the footprint take opened on a+ # giant REFERENCE label). A single part fills the canvas at extents, so+ # it gets one step; a whole sheet or board gets two plus one after centring.+ z1, z2 = (int(zoom[0]), int(zoom[1])) if zoom else (2, 1) plan = [ ("extents", _aim),- ("zoom-in", lambda: wheel(2, aim["x"], aim["y"])),+ ("zoom-in", lambda: wheel(z1, aim["x"], aim["y"])), ("centre", lambda: drag("middle", aim["x"], aim["y"], cx, cy, steps=18)),- ("zoom-in-2", lambda: wheel(1, cx, cy)),+ ] + ([("zoom-in-2", lambda: wheel(z2, cx, cy))] if z2 else []) + [ ("pan-look", lambda: drag("middle", cx, cy, cx - dx, cy - dy, steps=14)), ("pan-back", lambda: drag("middle", cx - dx, cy - dy, cx, cy, steps=14)),- ("zoom-out", lambda: wheel(-3, cx, cy)),+ ("zoom-out", lambda: wheel(-(z1 + z2), cx, cy)), ("extents-2", lambda: key(VK_HOME)), ] for name, fn in plan: