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

Pixel size setting can misalign canvas #305

Open
TodePond opened this issue Dec 23, 2024 · 2 comments
Open

Pixel size setting can misalign canvas #305

TodePond opened this issue Dec 23, 2024 · 2 comments

Comments

@TodePond
Copy link
Contributor

I can repro like this. Probably device dependent. MacOS Chrome. My screen as 2 DPI.

  1. Make sure your pixel size setting is set to 1.
  2. Put a rectangle on the screen, eg:
shape().out()
  1. Make sure it's visible and in the middle of the screen.
  2. Change the pixel size setting to 2.

Expected: Rectangle is still within the middle of the screen.
Actual: Rectangle is not visible.

Interestingly, this works fine:

shape().scrollX(0).out()

Will investigate this further!

@sqaxomonophonen
Copy link
Contributor

sqaxomonophonen commented Dec 23, 2024

The canvas sizing happens here:

width={window.innerWidth / displaySettings.canvasPixelSize}
height={window.innerHeight / displaySettings.canvasPixelSize}

Before my patch it was:

      width={window.innerWidth}
      height={window.innerHeight}

I suspect the misalignment may also happen when resizing the window?

@TodePond
Copy link
Contributor Author

I suspect the misalignment may also happen when resizing the window?

Yes I imagine so! I was trying out some fixes but got distracted by #307 instead :)

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

No branches or pull requests

2 participants