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 2 years 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

In terms of auto-shrink and auto-expand (when moving a member out and into a scope), @senwang86's feedback is "Auto-layout resets my preferred scope size multiple times, which is annoying" Hence, I think we shall have an option to allow users to toggle auto-shrink per-scope. Auto-expand should always be on.

forrestbao avatar Jul 20 '23 07:07 forrestbao

Regarding auto-shovel, this is @senwang86's comments "Inserting a pod between 2 pods makes overall layout messy" Hence, @senwang86 please see my ideas 2 to 5 in post 1

forrestbao avatar Jul 20 '23 07:07 forrestbao

Supplement some context regarding Dr. Bao's comments above.

I gave more tests upon importing a Jupyter notebook, and the recording here shows some improvement are needed regarding auto-layout,

  • Auto-layout resets my preferred scope size multiple times, which is annoying

  • Inserting a pod between 2 pods makes overall layout messy (04:58)

senwang86 avatar Jul 20 '23 17:07 senwang86

  • Auto-layout resets my preferred scope size multiple times, which is annoying

I have seen the video. I feel part of the reason is how you use CodePod. Why do you wanna create a big empty scope? A scope is designed to tightly wrap pods. The way I use it to create pods inside of a scope and the scope will grow automatically. Similarly, it will grow as you move pods/scopes into a scope.

  • Inserting a pod between 2 pods makes overall layout messy (04:58)

I agree with this.

forrestbao avatar Jul 20 '23 18:07 forrestbao