Skip to content
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

Merged
merged 19 commits into from
Apr 11, 2024
Merged

Conversation

thequilo
Copy link
Member

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:

  • much shorter implementations for the minimaps (because the communication code is gone)
  • reasoning about state changes is easier because everything is handled in a central location
  • throttling is synchronized between plots and applied to both word filtering and plotting
  • It is easier to determine which plots have to be updated, which results in significant speedups for viewing long recordings

Additionally, functionality was added to synchronize plots in a side-by-side view.

- 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)
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)) {
Copy link
Member

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.

Copy link
Member Author

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];
Copy link
Member

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.

@thequilo thequilo merged commit 944dde2 into main Apr 11, 2024
6 checks passed
@thequilo thequilo deleted the viz-centralized-state branch September 3, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants