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

(PC-30155)[PRO] fix: protect canvas from being to big to fix error se… #12915

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

Aliochka
Copy link
Contributor

…ntry

But de la pull request

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-30155

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques

Copy link
Contributor

Visit the preview URL for this PR (updated for commit d474834):

https://pc-pro-testing--pr12915-pc-30155-canveas-siz-opvemvi8.web.app

(expires Thu, 27 Jun 2024 08:14:01 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 032d233ee67e1c50d6af12e29c936c7076770eb1


/* Protect the chart from being too tall
InvalidStateError: CanvasRenderingContext2D.setTransform: Canvas exceeds max size. */
max-height: rem.torem(2000px);
Copy link
Contributor

Choose a reason for hiding this comment

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

C'est pas énorme 2000 pour une valeur initiale ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

l'erreur arrive quand le canvas est beaucoup trop énorme, on m'a proposé de mettre un grand max height du coup pour que ça arrive pas

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 mais ça veut dire qu'on peut mettre une taille "normale", non ?

Si le problème c'est quand il est trop grand, pourquoi mettre une grande valeur ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes c'est ce que j'avais en tête. On peut aussi rajouter un max-width pour couvrir tous les cas. Et si le problème persiste on pourra tenter un truc du genre

canvas.width = Math.min(canvas.parentElement.clientWidth, 1200);
canvas.height = Math.min(canvas.parentElement.clientHeight, 2000);

@Aliochka Aliochka merged commit 6082cd4 into master Jun 27, 2024
19 checks passed
@Aliochka Aliochka deleted the PC-30155-canveas-size-error branch June 27, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants