-
Notifications
You must be signed in to change notification settings - Fork 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
Implement state for zoom and search #198
Conversation
8321e54
to
0eb6b9f
Compare
Hey @brendangregg, would you prefer this functionality to be enabled/disabled per parameter switch (something like --state/--nostate, depending on which behavior is preferred) if you were to accept this PR? |
backport brendangregg/FlameGraph#198 with states for history
I tried this out and it's great, thanks -- solves the problem without increasing the SVG size. If you have a chance, can you do the resolve conflicts, and also make it so if I click the "all" frame at the bottom it shouldn't put stuff in the URL as that's essentially clearing the zoom. I thought there was a perf regression as zooming was slower with this change, and Chrome profiling showed a lot more time in GC, but I now think it was just a tab that was out of memory. Opening it again in a new tab and it was fast again. Huh. |
Using history.replaceState[1], a zoom state can be accessed by using the y and x frame attributes. history.pushState was explicitly not used since it would bring a slew of new issues to resolve (browser back and forward state). 1. https://developer.mozilla.org/en-US/docs/Web/API/History_API
@brendangregg Done |
- Do not overwrite the passed term variable in search() - Passed search parameter overwrites currentSearchTerm
@brendangregg still interested? |
thanks! |
Hey @brendangregg,
looking through old PRs I found #134 very interesting. I have implemented a history safe (meaning the browsers back and forward functions won't interfere) solution that "safes" the zoom and/or search state.
It basically uses CSS attribute selectors[1] to match a frame (
[x=100][y=200]
) and uses GET parameters using thehistory
API[2] to "store" the current zoom/search state.Cheers,
Mike
[1] https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
[2] https://developer.mozilla.org/en-US/docs/Web/API/History_API