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

perf(track): stretch instead of redraw #1012

Closed
wants to merge 1 commit into from
Closed

Conversation

etowahadams
Copy link
Contributor

Fix #1006
Toward #

Change List

  • Stretch graphics instead of redraw

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

Comment on lines +414 to +431
/**
* Calulates how much the tile has been scaled, and how much to offset the tile.
* @param drawnAtScale The scale at which the tile has been drawn
* @returns [scale, offset]
*/
#getYScaleAndOffset(drawnAtScale: ScaleContinuousNumeric<number, number>) {
const dA = drawnAtScale.domain();
const dB = this._yScale.domain();

// scaling between tiles
const tileK = (dA[1] - dA[0]) / (dB[1] - dB[0]);

const newRange = this._yScale.domain().map(drawnAtScale);

const posOffset = newRange[0];

return [tileK, -posOffset * tileK];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being used for now, just a sketch

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.

Performance: Stretch and translate instead of redraw
1 participant