-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redraw restrictions panel when dragging sidebar #5502
Redraw restrictions panel when dragging sidebar #5502
Conversation
Hi @jguthrie100! Thanks for working on this. It would be nice if it only responded during resizing. Otherwise the event is constantly firing. You may want to look at the |
I've changed the implementation so that the restrictions panel is redrawn everytime Do you know of any good coding practices to limit the call numbers (other than setInterval or having some rudimentary counter loop?) - unless its fine as is? |
2bed29d
to
c002ab8
Compare
703516d
to
7bf4c46
Compare
@quincylvania I'm a bit unsure what you mean by that? And is there anything I can change to get this merged? The redraw threshold could probably be lowered to 1px if there are concerns about it being a bit jaggy, and I'm assuming most browsers would be able to handle it (considering the entire map is redrawn so frequently whilst dragging around the map!) |
I'm not sure I know what I mean 😂 It looks like you found a way to react to the changes without a timer and to avoid too many redraws, so it seems fine to me! I do think I'd prefer a 1px threshold unless we see real performance issues; we can always adjust it later. As far as getting this merged, @bhousel can speak to that. |
Thanks @jguthrie100 & @quincylvania - this looks pretty good to merge... |
Fixes #5474
I've put together a bit of a hacky fix for the restrictions editor not scaling properly with the sidebar being dragged.
Ideally, I'd call the
redraw()
method direction from the sidebar's drag handler, but can't figure out a way to get access to it efficiently, so instead I just add adragging
class when the drag starts and remove it when it stops.The restrictions.js file then just sets a
setInterval
that checks whether thedragged
class is present or not, and then redraws the panel every 50ms if it is.The redraw interval can be changed easily enough (is 50ms too frequent?), but when dragging, the street graphics are chopped off so close to the border of the svg, that when dragging, the chopped-off street edge is still visible for a few ms until the panel redraws.
The only way I can think of getting around that is to render the junction so that the streets are initially drawn much further out past the svg border, meaning when the svg resizes, there is much more 'buffer' space before the street-end is reached. (if that makes sense?)