Autoclose left panel on thumbnail or treenode select#1325
Conversation
UV -> my dev
…moreinfo Mobile trigger moreinfo
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
demiankatz
left a comment
There was a problem hiding this comment.
Thanks, @jamesmisson -- this makes sense to me and seems to work reasonably well. See below for some very nitpicky suggestions just focused on making the PR as clean as possible.
Beyond that, a couple of other comments:
1.) This is of unquestionable value at the small size. I think the medium size is debatable. In the ideal world, I would think that the metric for auto-closing the control might be whether the panel is initially visible or not -- i.e., if you need to explicitly open the panel, then it makes sense for it to close when you pick a thumbnail; if it was initially open by default, it feels a little weird if it closes when you click a thumbnail. If there's no easy practical way to implement that, I can live with what we have... and maybe that is how it behaves (I didn't have time to dig deeply into initial behavior at all sizes).
2.) At one point during my testing, I ended up with the viewer in a weird state where the center panel was very short, and the maroon-colored background area was showing between the center panel and the footer. I'm not sure how I got there, but it probably involved a lot of browser resizing, etc. I'm not going to worry about it too much right now since things are in flux, but we'll want to watch for this bad state as we move forward in case it's a symptom of a real problem that we need to worry about.
|
Thanks @demiankatz , I've done those bits of clean-up. I've also changed it so that it only auto-closes in 'sm' size for now. I agree that ultimately we want it to auto-close if its initial state is closed. I tried something that should work, but it doesn't work in this branch yet as I think determining the open/closed state on initiation might still be up in the air for mobile. Here's the method I used (partly for my own reference if we implement it later):
` init(): void { }`
It would be useful if we can talk about the initial open/closed state with @LlGC-jop before implementing this. |
|
Getting the initial metric and making it a property of the baseExpandPanel in order to determine autoclosing is proving a bit tricky. The _updateMetric() method on BaseExtension supplies the current metric on init, but for some reason it's got a 1ms delay on it, so it's happening after the baseExpandPanels are initiating, so checking for 'sm' at higher class levels is giving 'undefined'. Will return to this tomorrow. if checking the metric value from the panels worked, then putting this either on leftPanel or contentLeftPanel would cover the conditions for setting the initial state, taking into account the last user state of the panel, the config on init, and the size on init:
(this is probably why the 'isMobile()' on the baseExtension exists, as it checks this.metric there rather than checking this.extension.metric.) |
|
@jamesmisson, I wonder if this is a situation where emitting an event might help... though that gets messy pretty quickly. |
… leftpanel with isMetric
…o autoclose-mobile-thumbnails
…smisson/universalviewer into autoclose-mobile-thumbnails
demiankatz
left a comment
There was a problem hiding this comment.
See below for a couple of small thoughts/suggestions.
demiankatz
left a comment
There was a problem hiding this comment.
Thanks, @jamesmisson -- looking good, but one small detail in need of attention.
|
Thanks, @jamesmisson -- everything looks good now. I'm not going to approve this yet since I expect we may not want to merge this PR as-is. I'll wait until our conversation with @LlGC-jop tomorrow to figure out which PRs are actually destined for merging to dev and which will be closed as partial work in progress. |
|
Superseded by #1343. |
Part of #938
CSS is still in progress, this is for functionality only.
This adds 2 event subscriptions so that the left panel closes when a thumbnail or index tree node is selected in mobile view.
the isMobileMetric() counts both 'sm' and 'md' sizes as 'mobile'.