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

Drawing bbox fix for window scroll #1683

Merged
merged 9 commits into from
May 16, 2017
Merged

Conversation

etpinard
Copy link
Contributor

fixes #1678

I decide to play it safe an revert 29abb5d until we 🔒 the Drawing.bBox behavior better. Reverting 29abb5d also fixes #1675, but maybe we could do better there.

cc @alexcjohnson

@etpinard etpinard added status: reviewable bug something broken labels May 12, 2017
left: -20.671875,
top: -11,
right: 20.34375,
bottom: 3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commit 29abb5d made the bottom and top keys here incorrectly change - as the bbox computation were based on a outdated cached tester element.

Copy link
Contributor Author

@etpinard etpinard May 12, 2017

Choose a reason for hiding this comment

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

The width, left and right keys change correctly here in response to the annotation text relayout update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Ha, those values appear to be machine-dependent (I suspect a font issue) ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 3fdb308

- so that Drawing.bBox does not have to query the DOM
  to fing them on every call.
- to not have to instantiate one on every appendSVG call
@etpinard etpinard mentioned this pull request May 15, 2017
if(!drawing.refRect) {
drawing.refRect = drawing.test3.select('.js-reference-point')
var testRect = testNode.getBoundingClientRect(),
refRect = test3.select('.js-reference-point')
.node().getBoundingClientRect();
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to keep the perf gains from #1585 in this fix, I'm pretty sure the only change we'd need is to call this .getBoundingClientRect() with each drawing.bBox call, rather than caching it. But we can still cache tester, and we can cache test3.select('.js-reference-point').node().

Just a question of timing really - now that you have a scrolling test in place it seems safe to me, but you can leave it as is for now if you need to move on to other things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's in #1690

@alexcjohnson
Copy link
Collaborator

💃 once #1690 is merged and tests pass

@etpinard etpinard merged commit 2e0cca1 into master May 16, 2017
@etpinard etpinard deleted the annotation-text-position-fix branch May 16, 2017 19:15
@etpinard etpinard mentioned this pull request May 24, 2017
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
2 participants