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

(ios): Small context does not render #89

Closed
CatchABus opened this issue Sep 11, 2022 · 4 comments
Closed

(ios): Small context does not render #89

CatchABus opened this issue Sep 11, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@CatchABus
Copy link
Contributor

In iOS, there are cases when canvas 2D will not draw if content to draw is minimal.
For example, this will not get drawn:

var ctx = canvas.getContext('2d');

ctx.font = "40px 'Helvetica'";
ctx.fillText ("Hello World", 10, 60);

However, it gets drawn if I set useCpu to true in node_modules.

I suspect the default rendering mode expects a certain number of calls in order to draw, because charts get drawn in both modes. Chart.js is a good example because it performs lots of drawings on canvas.

@CatchABus
Copy link
Contributor Author

@triniwiz It seems that chart won't get drawn too.
I discovered that putting my code inside a timeout helps canvas draw.

This will never draw:

var ctx = canvas.getContext('2d');

ctx.font = "40px 'Helvetica'";
ctx.fillText ("Hello World", 10, 60);

This will draw:

setTimeout(() => {
    var ctx = canvas.getContext('2d');

    ctx.font = "40px 'Helvetica'";
    ctx.fillText ("Hello World", 10, 60);
  }, 0);

Does that give any hints?

@triniwiz
Copy link
Member

You mentioned small context, what is the size of the view ?

@CatchABus
Copy link
Contributor Author

You mentioned small context, what is the size of the view ?

It seems it's not about context anymore. Chart also failed to draw but I didn't notice because I also update it using a callback.
No matter what context, nothing gets drawn unless called inside a callback (e.g. setTimeout) like I described above.
It's as if something blocks drawing.

@triniwiz triniwiz added the bug Something isn't working label Nov 13, 2022
@triniwiz
Copy link
Member

triniwiz commented Feb 2, 2024

This should not be an issue in v2

@triniwiz triniwiz closed this as completed Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants