-
Notifications
You must be signed in to change notification settings - Fork 14
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
Centralize viewArea state in Visualization #70
Conversation
- Disable zooming/viewport scaling - Scale visualization to full window size - Make tooltips scrollable when they are larger than the screen size
- Allows for modifying the content before the tooltip is shown, which previously broke the tooltip positioning
- Much simpler event flow - Major performance improvements when scrolling locally in large visualizations - Many bug fixes. The major ones are: - Scrolling & event bundling works again - Touch drag works again - Decoupled throttle intervals (passing this.draw as object to call_throttled calls draw on only one object and swallows calls from other objects)
meeteval/viz/visualize.js
Outdated
for (let j = anchor + 1; j < viewAreas.length; j++) { | ||
let v = viewAreas[j]; | ||
const parent = viewAreas[j - 1]; | ||
if (parent[1] - parent[0] < v[1] - v[0] || similar_range(oldViewAreas[j - 1], v)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be marked as dirty, when the values ares the same? A draw wouldn't be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved, now only marked as dirty when !similar_rate(viewAreas[j], v)
function adjustViewAreas(viewAreas, anchor, viewArea) { | ||
const dirty = viewAreas.map(() => false); | ||
|
||
const oldViewAreas = [...viewAreas]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, if it works as intended. You do inplace changes and keep only the old value if the child is larger than the parent.
If this is the indented behavior, it should be documented.
The viewAreas are now managed in a central location instead of in the local minimap objects. The central state is a single source of truth and eliminates much of the communication between plot objects. This has a few benefits:
Additionally, functionality was added to synchronize plots in a side-by-side view.