Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Graphie] Adjust Scaling of Text to Render Properly in Mobile (#1540)
## Summary: When a graphie image is displayed in a scaled-down environment (i.e. mobile viewport), SVG elements were scaled properly, but text was not. The issue was due to scaling not being applied to the text. This change adds in the calculations to properly scale and position text that exists in the image. Issue: LEMS-2022 ## Test plan: 1. Obtain a Graphie image. * From Graphie editor: * Open a Graphie editor for an existing image. * Click on the "Convert to image" button. * Wait for the image web address to be generated. * Or, just use this example image: <br/> web+graphie://ka-perseus-graphie.s3.amazonaws.com/2c7f2619eec00ab1992b4a491a0359542012b286. 2. Open an [editor page](https://www.khanacademy.org/devadmin/content/articles/test-article-for-the-test-course/xf02c39bb55c6da4a) (Storybook editor pages aren't working properly with Graphie images at the time of this PR). 3. Add an image widget. 4. Paste the image URL into the available entry field. 5. Compare the image preview using the available Desktop and Mobile toggles. 6. The text elements (i.e. point labels) should be scaled with the image (lines, etc.) and placed correctly. ## Affected behavior ### Before - bad text ![Bad Text](https://github.com/user-attachments/assets/009bae41-8770-479a-8621-e22300e41fe5) ### After - good text ![Good Text](https://github.com/user-attachments/assets/2289887d-f41c-4035-9ec4-855162081df3) Author: mark-fitzgerald Reviewers: nishasy, jeremywiebe, mark-fitzgerald, catandthemachines Required Reviewers: Approved By: nishasy, jeremywiebe, catandthemachines Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1540
- Loading branch information