Interaction · Pointer: handles inside the box, drags from the press
Resizable's grip sits inside the box's lower right corner and its edge handles lie inside the edges, their lines on the edge; the edges use layout::resize_edge, a resize_handle whose line shows only while hovered, since the box draws its own border. A drag now measures from the handle's press, kept in keyed state, so the edge follows the pointer from the first move. Tests drag the right edge downward and the bottom edge sideways, turn the dial without Shift, and draw a band with Shift over a selection.
This commit is contained in:
1 parent
040fc94f49
commit
c19c45ca8a
6 files changed
+125
-32
No files matched your search
@@ -174,6 +174,14 @@ mod tests {
|
||||
assert_eq!(angle_at(ring, point(px(100.0), px(50.0)), false), 90.0);
|
||||
assert_eq!(angle_at(ring, point(px(50.0), px(100.0)), false), 180.0);
|
||||
assert_eq!(angle_at(ring, point(px(0.0), px(50.0)), false), 270.0);
|
||||
let eleven = point(
|
||||
px(50.0 + 50.0 * 11f32.to_radians().sin()),
|
||||
px(50.0 - 50.0 * 11f32.to_radians().cos()),
|
||||
);
|
||||
assert!(
|
||||
(angle_at(ring, eleven, false) - 11.0).abs() < 1e-3,
|
||||
"free, it stays at 11°"
|
||||
);
|
||||
let near = angle_at(ring, point(px(60.0), px(0.0)), true);
|
||||
assert_eq!(near, 15.0, "11° snaps to the nearest notch");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user