Skip to content

Fix incorrect scale when zooming - #314

Merged
cdata merged 1 commit into
masterfrom
fix-zoom-rendering
Jan 29, 2019
Merged

cdata merged 1 commit into
masterfrom
fix-zoom-rendering

Conversation

@cdata

@cdata cdata commented Jan 29, 2019 •

Copy link
Copy Markdown
Contributor

Zooming (e.g., with ⌘ +/⌘ -) changes the effective devicePixelRatio and lays everything out accordingly. Previously, WebGLRenderer's DPR was not being updated under these circumstances, causing the model to be incorrectly staged under zoom events (and, incidentally, when turning on device emulation in dev tools).

Current behavior New behavior
resizedprbad resizedprgood
resizedprmobilebad resizedprmobilegood

Fixes #298

@cdata
cdata requested review from jsantell and smalls January 29, 2019 03:00
jsantell
jsantell previously approved these changes Jan 29, 2019

@jsantell jsantell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! 👍

Is there any cost to window.devicePixelRatio on every frame?

@cdata

cdata commented Jan 29, 2019

Copy link
Copy Markdown
Contributor Author

Is there any cost to window.devicePixelRatio on every frame?

I doubt it, but I will check.

(IIUC we already read it on every frame)

@cdata

cdata commented Jan 29, 2019

Copy link
Copy Markdown
Contributor Author

Seems like the cost is negligible:

image

image

image

image

@jsantell jsantell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jsperf to the rescue

@cdata
cdata merged commit 895a113 into master Jan 29, 2019
@cdata
cdata deleted the fix-zoom-rendering branch January 29, 2019 16:22
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