Grow the editor's canvas to reach widgets below its edge
A widget that fell off the panel, after the canvas was made smaller, was drawn under the clip and could only be re-packed with Reflow. Editing, the canvas now extends to the lowest widget and scrolls, with the panel's own edge dashed and the area past it hatched, so the widget can be dragged back. The scale stays the panel's, and view mode is unchanged.
This commit is contained in:
@@ -561,6 +561,11 @@ export function DashboardEditor({
|
||||
// now falls past its bottom edge drawn under the clip. A round face has no
|
||||
// grid to fall off.
|
||||
const clipped = round ? [] : layout.filter((item) => item.y + item.h > rows)
|
||||
// Editing, the canvas grows to reach them, so they can be dragged back.
|
||||
const reach =
|
||||
edit && clipped.length
|
||||
? Math.max(...clipped.map((item) => item.y + item.h))
|
||||
: undefined
|
||||
const shown = Math.max(
|
||||
0,
|
||||
widgets.findIndex((widget) => widget.id === (selected ?? face)),
|
||||
@@ -669,7 +674,7 @@ export function DashboardEditor({
|
||||
) : null}
|
||||
</div>
|
||||
) : (
|
||||
<CanvasSurface dashboard={draft} dots={edit} rail={rail}>
|
||||
<CanvasSurface dashboard={draft} dots={edit} rail={rail} reach={reach}>
|
||||
{(scale) =>
|
||||
!edit ? (
|
||||
<DashboardView dashboard={draft} rail={hasRail} />
|
||||
|
||||
Reference in New Issue
Block a user