Let canvas boxes go left of the canvas edge
The canvas is centred, so on wide screens there is margin to its left that boxes could not be dragged into: x was clamped to 0 in the drag geometry, the arrow-key nudge and validateBox. Only y stays clamped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -35,13 +35,14 @@ func TestValidateBox(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// Geometry is clamped, not rejected: a drag past the canvas edge lands
|
||||
// at the edge, and a box can never shrink below a grabbable size.
|
||||
// Geometry is clamped, not rejected: x may go negative, into the margin
|
||||
// left of a centred canvas, but nothing goes above the top or below a
|
||||
// grabbable size.
|
||||
box := models.Box{Page: "stp", Kind: "widget", Widget: str("Chat"), X: -30, Y: -1, W: 5, H: 0}
|
||||
if err := validateBox(&box); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if box.X != 0 || box.Y != 0 || box.W != minBoxSize || box.H != minBoxSize {
|
||||
t.Fatalf("clamped to %d,%d %dx%d; want 0,0 %dx%d", box.X, box.Y, box.W, box.H, minBoxSize, minBoxSize)
|
||||
if box.X != -30 || box.Y != 0 || box.W != minBoxSize || box.H != minBoxSize {
|
||||
t.Fatalf("clamped to %d,%d %dx%d; want -30,0 %dx%d", box.X, box.Y, box.W, box.H, minBoxSize, minBoxSize)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user