feat: add smooth interactive axis view and diagonal snapping

This commit is contained in:
bherbruck committed 2026-10-11 08:51:24 -04:00
1 parent 6cbcf5c823
commit 43a02625a2
24 files changed
+673 -520

No files matched your search

@@ -0,0 +1,56 @@
[
{
"note": "Viewport right-drag orbits freely; holding Shift snaps after accumulated motion."
},
{
"call": "ui.view",
"params": {
"view": "front"
}
},
{
"call": "ui.drag",
"params": {
"x0": 800,
"y0": 500,
"x1": 848,
"y1": 500,
"steps": 8,
"button": "right"
}
},
{
"expect": {
"camera": {
"yaw_deg": 22,
"pitch_deg": 0
}
}
},
{
"call": "ui.view",
"params": {
"view": "front"
}
},
{
"call": "ui.drag",
"params": {
"x0": 800,
"y0": 500,
"x1": 920,
"y1": 500,
"steps": 40,
"shift": true,
"button": "right"
}
},
{
"expect": {
"camera": {
"yaw_deg": 45,
"pitch_deg": 0
}
}
}
]
@@ -0,0 +1,67 @@
[
{
"note": "Signed axis tips own one highlight at a time and choose principal views."
},
{
"call": "ui.view",
"params": {
"view": "home"
}
},
{
"move": {
"handle": "axis_view:z"
}
},
{
"expect": {
"count": {
"name": "axis_view_highlights",
"value": 1
},
"shown_handles": [
"axis_view_hover:z"
]
}
},
{
"click": {
"handle": "axis_view:z"
}
},
{
"expect": {
"camera": {
"yaw_deg": 0,
"pitch_deg": 90
}
}
},
{
"click": {
"handle": "axis_view:-y"
}
},
{
"expect": {
"camera": {
"yaw_deg": 0,
"pitch_deg": 0
}
}
},
{
"move": [
800,
500
]
},
{
"expect": {
"count": {
"name": "axis_view_highlights",
"value": 0
}
}
}
]
@@ -0,0 +1,73 @@
[
{
"note": "Top/bottom axis clicks preserve the nearest square heading in each up frame."
},
{
"camera": {
"yaw": -2.356194490192345,
"pitch": 0.6154797086703874
}
},
{
"click": {
"handle": "axis_view:z"
}
},
{
"expect": {
"camera": {
"yaw_deg": -90,
"pitch_deg": 90
}
}
},
{
"camera": {
"yaw": 2.9670597283903604,
"pitch": -0.6
}
},
{
"click": {
"handle": "axis_view:-z"
}
},
{
"expect": {
"camera": {
"yaw_deg": 180,
"pitch_deg": -90
}
}
},
{
"call": "ui.prefs",
"params": {
"up_axis": "y"
}
},
{
"camera": {
"yaw": -1.3962634015954636,
"pitch": 0.6
}
},
{
"click": {
"handle": "axis_view:y"
}
},
{
"expect": {
"camera": {
"yaw_deg": -90,
"pitch_deg": 90,
"back": [
0,
1,
0
]
}
}
}
]
@@ -0,0 +1,53 @@
[
{
"note": "Axis labels are world X/Y/Z; with Y up, Y chooses top and Z chooses front."
},
{
"call": "ui.prefs",
"params": {
"up_axis": "y"
}
},
{
"call": "ui.view",
"params": {
"view": "home"
}
},
{
"click": {
"handle": "axis_view:y"
}
},
{
"expect": {
"camera": {
"yaw_deg": 0,
"pitch_deg": 90,
"back": [
0,
1,
0
]
}
}
},
{
"click": {
"handle": "axis_view:z"
}
},
{
"expect": {
"camera": {
"yaw_deg": 0,
"pitch_deg": 0,
"back": [
0,
0,
1
]
}
}
}
]
@@ -1,22 +0,0 @@
[
{"note": "The view cube is a cube with chamfered corners. Its targets are the 6 faces and the 8 corner facets; hover lights exactly the one under the pointer (edges are not targets: a point on an edge goes to a neighbour), and a click turns the view to it."},
{"call": "ui.view", "params": {"view": "home"}},
{"move": {"cube": [0, 0, 1]}},
{"expect": {"count": {"name": "cube_highlights", "value": 1}, "shown_handles": ["cube_hover:top"]}},
{"move": {"cube": [0.3, -1, 0.2]}},
{"expect": {"count": {"name": "cube_highlights", "value": 1}, "shown_handles": ["cube_hover:front"]}},
{"note": "On the top-front edge: one target, the top or the front face."},
{"move": {"cube": [0, -1, 1]}},
{"expect": {"count": {"name": "cube_highlights", "value": 1}}},
{"move": {"cube": [0.873, -0.873, 0.873]}},
{"expect": {"count": {"name": "cube_highlights", "value": 1}, "shown_handles": ["cube_hover:top-front-right"]}},
{"click": {"handle": "cube:top-front-right"}},
{"expect": {"camera": {"yaw_deg": -45, "pitch_deg": 35.26}}},
{"click": {"handle": "cube:front"}},
{"expect": {"camera": {"yaw_deg": 0, "pitch_deg": 0}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:top-back-right"}},
{"expect": {"camera": {"yaw_deg": -135, "pitch_deg": 35.26}}},
{"move": [800, 500]},
{"expect": {"count": {"name": "cube_highlights", "value": 0}}}
]
@@ -1,10 +0,0 @@
[
{"note": "A cube drag rotates by the whole pointer movement and releasing it does not click the pressed face."},
{"call": "ui.view", "params": {"view": "front"}},
{"drag": [{"cube": [0, -1, 0]}, {"cube": [1.5, -1, 0]}]},
{"expect": {"camera": {"yaw_deg": 22, "pitch_deg": 0}}},
{"note": "A stationary click still selects a face."},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:front"}},
{"expect": {"camera": {"yaw_deg": 0, "pitch_deg": 0}}}
]
@@ -1,31 +0,0 @@
[
{"note": "TOP and BOTTOM keep the nearest square heading, with home ties toward yaw zero. Clicking side faces still selects their standard view."},
{"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 40, "width": 30, "height": 20}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:top"}},
{"expect": {"camera": {"yaw_deg": 0, "pitch_deg": 90}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:top-back-right"}},
{"expect": {"camera": {"yaw_deg": -135, "pitch_deg": 35.26}}},
{"click": {"handle": "cube:top"}},
{"expect": {"camera": {"yaw_deg": -90, "pitch_deg": 90, "back": [0, 0, 1]}}},
{"shot": "minimal-turn-top-z"},
{"camera": {"yaw": 2.9670597283903604, "pitch": -0.6}},
{"click": {"handle": "cube:bottom"}},
{"expect": {"camera": {"yaw_deg": 180, "pitch_deg": -90, "back": [0, 0, -1]}}},
{"camera": {"yaw": 1.3962634015954636, "pitch": 0.6}},
{"click": {"handle": "cube:top"}},
{"expect": {"camera": {"yaw_deg": 90, "pitch_deg": 90}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:front"}},
{"expect": {"camera": {"yaw_deg": 0, "pitch_deg": 0}}},
{"note": "The same heading choice is measured in the Y-up camera frame."},
{"call": "ui.prefs", "params": {"up_axis": "y"}},
{"camera": {"yaw": -1.3962634015954636, "pitch": 0.6}},
{"click": {"handle": "cube:top"}},
{"expect": {"camera": {"yaw_deg": -90, "pitch_deg": 90, "back": [0, 1, 0]}}},
{"shot": "minimal-turn-top-y"},
{"camera": {"yaw": 1.3962634015954636, "pitch": -0.6}},
{"click": {"handle": "cube:bottom"}},
{"expect": {"camera": {"yaw_deg": 90, "pitch_deg": -90, "back": [0, -1, 0]}}}
]
@@ -1,16 +0,0 @@
[
{"note": "With Y up (#3) the view cube turns with the world: its TOP is world +Y and clicking it looks down −Y in the standard plan orientation; FRONT looks along −Z."},
{"call": "engine.execute", "params": {"command": "solid.box", "params": {"length": 40, "width": 30, "height": 20}}},
{"call": "ui.prefs", "params": {"up_axis": "y"}},
{"call": "ui.view", "params": {"view": "home"}},
{"move": {"cube": [0, 0, 1]}},
{"expect": {"shown_handles": ["cube_hover:top"]}},
{"click": {"handle": "cube:top"}},
{"expect": {"camera": {"pitch_deg": 90, "yaw_deg": 0, "back": [0, 1, 0]}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:front"}},
{"expect": {"camera": {"pitch_deg": 0, "yaw_deg": 0, "back": [0, 0, 1]}}},
{"call": "ui.view", "params": {"view": "home"}},
{"click": {"handle": "cube:top-front-right"}},
{"expect": {"camera": {"pitch_deg": 35.26, "yaw_deg": -45, "back": [0.57735, 0.57735, 0.57735]}}}
]