Skip to content

Conversation

@tunglev
Copy link

@tunglev tunglev commented Nov 15, 2023

Sometimes, plotting-canvas does not cover the entire screen. I my case, when I use npm run serve it will spans, but if I use npx lite-server, which is a local server, it somehow doesn't work. This is a fix on the CSS of setup() to guarantee it will span whole screen on every server

@tunglev
Copy link
Author

tunglev commented Nov 15, 2023

This is the updated PR to #325 I closed earlier

@jeffhuang
Copy link
Contributor

Thanks. Is the actual substantive change these 4 lines?

		canvas.style.pointerEvents = 'none'
		canvas.style.top = '50vh'
		canvas.style.left = '50vw'
		canvas.style.transform = 'translate(-50%, -50%)'

@tunglev
Copy link
Author

tunglev commented Nov 15, 2023

yeah just that!

@jeffhuang
Copy link
Contributor

hmmm can you say a bit about why this fix works? like it seems to shift and unshift the canvas

@tunglev
Copy link
Author

tunglev commented Nov 16, 2023

You're right. Turn out it was the body padding of the CSS of my website. But I would suggest adding:

canvas.style.pointerEvents = 'none'
canvas.style.top = '0px'
canvas.style.left = '0px'

so that the plotting-canvas would always span independently regardless of the client's CSS files.

Also, you are absolutely correct that it shifts and unshifts the canvas. Therefore, top and left equal to 0px would be sufficient.

@tunglev
Copy link
Author

tunglev commented Nov 16, 2023

Also my code editor auto formatted the code, so I'll try to write it in the format of the original

@tunglev tunglev closed this Nov 16, 2023
@tunglev tunglev deleted the PR branch November 16, 2023 18:17
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