Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Improve room sublist resizing #2440

Merged
merged 27 commits into from
Jan 16, 2019
Merged

Improve room sublist resizing #2440

merged 27 commits into from
Jan 16, 2019

Conversation

bwindels
Copy link
Contributor

element-hq/element-web#8055

Changes the room sublist resizing in two ways:

  • removes the "lock to show all items" behaviour in place up till now (once an item is sized past it's content size, it gets a higher priority to not show a scrollbar), as multiple large locked items couldn't be resized properly anymore.

  • when a room sublist reaches it min size (header + 1 room tile) or max size (size to have no scrollbar), start shrinking/growing the previous item so the resize action flows over to the item before it, ... giving less the feeling that an item is blocked at it's min or max size.

    • as part of that, the assigned sizes are now normalized (max-height is set to the actual height) to their actual on screen size just before starting the resize operation, to have less jumping.
    • sized items are not shrinking relative to the size of their content anymore (flex-basis set to 0 instead of auto), resulting in less jumpiness while resizing when space gets tight.

Code-wise, the concept of a ResizeItem was introduced to easily go from one item to the next for the overflowing behaviour, calling callbacks, ...

As a cleanup, instead of passing the constructors for the Distributor (sizing algorithm), the Sizer (dom interactions for sizing/measuring) and ResizeItem, the distributor creates the instances of the helper classes it needs through static methods and only its constructor is passed in.

intellisize3

otherwise it just grows with max-height
as mouseup can't be detected outside of viewport
- move some methods to ResizeItem subclass
- allow distributor to instanciate sizer and resizeitem it needs
  through static factory methods, instead of passing in another ctor
  a distributor can only function with the right item and sizer anyways.
- use consistent import/export style
- remove obsolete code
reshuffle file structure to make more sense
@bwindels
Copy link
Contributor Author

Marked as not ready because Matthew pointed out a few issues that need further investigation.

@bwindels
Copy link
Contributor Author

Marked as not ready because Matthew pointed out a few issues that need further investigation.

Investigated and decided to not fix these now as it would be some work. Filed element-hq/element-web#8125 to track the work left.

@bwindels bwindels removed the notready label Jan 15, 2019
@bwindels bwindels requested a review from a team January 15, 2019 09:34
@bwindels
Copy link
Contributor Author

ah, just tested with empty sublists and clearing localstorage, it's broken, need to fix.

before, we'd only normalize the sublists that had already been
sized manually. As non-sized items still have flex-basis: auto,
they would claim all the space, and mixing sized and unsized items
would be badly broken.

Now, on the first click, all items are sized to their rendered size
which means they won't flex anymore, but at least the resizing works
this way

Another downside is that when resizing while a sublist is
collapsed, it's reverted to 100px and if a size had been set before,
it's forgotten. No way around this with this approach I'm afraid.
@bwindels bwindels removed the notready label Jan 15, 2019
@bwindels
Copy link
Contributor Author

ah, just tested with empty sublists and clearing localstorage, it's broken, need to fix.

Should be fixed now, by sizing all items to their rendered size on first click

@turt2live turt2live self-assigned this Jan 15, 2019
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to look right, albeit complicated. I've highlighted mostly minor things.

src/resizer/distributors/collapse.js Outdated Show resolved Hide resolved
src/resizer/distributors/fixed.js Outdated Show resolved Hide resolved
src/resizer/distributors/fixed.js Outdated Show resolved Hide resolved
src/resizer/distributors/roomsublist.js Outdated Show resolved Hide resolved
src/resizer/item.js Outdated Show resolved Hide resolved
@turt2live turt2live assigned bwindels and unassigned turt2live Jan 15, 2019
turt2live and others added 5 commits January 16, 2019 10:29
Co-Authored-By: bwindels <bruno@windels.cloud>
Co-Authored-By: bwindels <bruno@windels.cloud>
Co-Authored-By: bwindels <bruno@windels.cloud>
Co-Authored-By: bwindels <bruno@windels.cloud>
@bwindels bwindels merged commit 0229453 into experimental Jan 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants