FRLayeredNavigationController icon indicating copy to clipboard operation
FRLayeredNavigationController copied to clipboard

Multiple stacking points

Open skogsbaer opened this issue 12 years ago • 1 comments

At the moment, FRLayeredNavigationController supports only one explicit stacking point (configured via the initialViewPosition property of FRLayeredNavigationItem). In addition, there is an implicit stacking point at the right margin of each layer.

It would be great if each layer could have several explicit stacking points. Each stacking point would have an additional priority which specifies the ordering of stacking. Let me explain via an example:

+--------------+ +-----------+ +-------------+
|              | |  xxxxx    | | zzzzzzzz    |
|              | |  xxxxx    | | zzzzzzzz    |
+--------------+ +-----------+ +-------------+
A    B              C    D

The stacking points A, B, C and D have the following priorities:

A: 1
B: 3
C: 2
D: 4

If the frame now becomes smaller, FRLayeredNavigationController first moves the right-most layer to stacking point D. If after this, the layers do not fit into the new frame, the controller moves the middle layer to stacking poing B. If there is still need for more space, the left-most layer is moved to C. If there is still need for more space, the middle layer is moved to A. You see, layers are moved to stacking points in descending order of priorities.

What do you think? I'm willing to implement this feature but would like to ask for feedback first.

skogsbaer avatar Aug 24 '12 13:08 skogsbaer

This feature seems great and your willingness to implement it is even better :-).

Just some comments from my side:

  • Currently the left stacking point should usually not be set using initialViewPosition but via the parent's (the layer below) layeredNavigationItem.nextItemDistance
  • I think it's good that the parent/the layer below controls where the next layers can be "snapped in"
  • The nextItemDistance property should probably be replaced by a NSSet for the "snapping points", Additionally nextItemDistance could still be short-hand for [NSSet setWithObject:x] so the API wouldn't be affected at all.
  • We should think about whether we need a separate set of "snapping points" for landscape and portrait modes...
  • I already implemented a similar feature in FRShutterViewController (in this file)

Thank you!

weissi avatar Aug 24 '12 14:08 weissi