codepod icon indicating copy to clipboard operation
codepod copied to clipboard

Thought-in-progress: better and finer-granularity layout assistance

Open forrestbao opened this issue 1 year ago • 4 comments

Auto-layout covers two kinds of problems:

  1. Shape of scopes/pods: Auto-shrink and auto-expand a scope when a pod is moved out and into the scope.
  2. Placement of scopes/pods: Auto-shovel to push away pods/scopes when overlaps happen.

A bit history:

  1. Auto-shrink and auto-expand were added for https://github.com/codepod-io/codepod/issues/151
  2. Auto-shovel (without auto-retract) was added for https://github.com/codepod-io/codepod/issues/176

While 1 always makes life easier, 2 is not always as it sometimes breaks the manual placement of pods/scopes.

Idea 1: allowing users to enable and disable individual options under auto-layout. I feel life will very good with 1 enabled and 2 disabled and snapping enabled.

Idea 2: keeping the snapping relationship. For example, if two pods are snapped with their tops aligned, then the top of them should remained aligned in the future. If auto-shovel pushes one up, then both of them should be pushed up to remain top-aligned.

Idea 3: optional and needing additional thinking, is how to shovel pods/scopes to make space for a pod newly created or dragged that overlaps with existing pods. The force-based auto-layout is far from ideal. It could push aligned pods/scopes out of alignment. Alternatively, CodePod can ask the user what to do from 4 options: pushing the pods above/below/left/right away. This is like inserting cells into a spreadsheet.

Idea 4: allowing pods/scopes to be pinned at where they are. So the location of a pod/scope with respect to its scope is fixed. Auto-shovel shall not change the location of a fixed scope/pod. But this may make designing the auto-shovel algorithm difficult.

Idea 5: Tile or semi-tile based layout in a scope.

forrestbao avatar Jun 20 '23 08:06 forrestbao