Closed TungVietLe closed 10 months ago
This is the updated PR to #325
I closed earlier
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%)'
yeah just that!
hmmm can you say a bit about why this fix works? like it seems to shift and unshift the canvas
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.
Also my code editor auto formatted the code, so I'll try to write it in the format of the original
Sometimes,
plotting-canvas
does not cover the entire screen. I my case, when I usenpm run serve
it will spans, but if I usenpx lite-server
, which is a local server, it somehow doesn't work. This is a fix on theCSS
ofsetup()
to guarantee it will span whole screen on every server