Skip to content

Improve overlap handling. #90

@cameron-toy

Description

@cameron-toy

The Problem

Overlap handling isn't very good, and outright fails in certain cases.

Background

Currently, dashboards have rudimentary overlap detection and resolution for outputs. Placing one output on others will cause the other outputs to move up/down relative to the placed widget so they're no longer overlapping.

overlap

If placing a widget would cause the other widgets to move beyond the edge of the dashboard, the dashboard will be expanded to accommodate them. This is currently broken for the top edge, and causes a gap between the placed widget and the overlapping widgets.

top_edge

Another annoying issue arises when one wants to align two outputs horizontally in free mode. Here, a small overlap can cause a chain reaction of moves that can really mess up a layout.

Finally, the current algorithm compares the area covered by a widget to the area covered by every other widget every time a widget moves to find overlaps. This inefficiency causes slowdowns with large layouts

The Solution

An improved overlap handling algorithm that is:

  1. Intuitive. It should be obvious where outputs will move if there's an overlap, or at least some visual indication.
  2. Unobtrusive. Overlapping outputs should move a minimal amount and for small overlaps it should be difficult to tell anything has happened at all.
  3. Fast. Overlap resolution should happen instantly.

Additional notes: I think some amount of snap-to-edge should replace small overlaps, and that resizing shouldn't occur at any point as part of overlap handling. Also, I'm open to solutions that involve horizontal movement.

Some alternate algorithms are described here: https://mikekling.com/comparing-algorithms-for-dispersing-overlapping-rectangles/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions