f5b95d5df2
This PR makes it so we don't bother measuring the max size of your browser canvas - if you're manipulating an image that is relatively small (ie: less than 8K resolution). Closes #2433 @SomeHats I reckon this has some conflicts with your PR, #2441 ## Why? Calculating the max canvas size... takes a long time on some devices, eg: Android Chrome. Most of the time, you don't need such a big canvas anyway. When you're exporting/importing a small image, we can assume that the max size will be big enough (based on some testing [here](https://github.com/jhildenbiddle/canvas-size?tab=readme-ov-file#test-results)). So we don't need to bother in those cases - speeding up the operation. If you're manipulating a larger image, we measure the max canvas size - as before. ## Anything else? This PR also moves the 'clamping' code to one place. Previously, it was repeated in three places, and it was annoying having to update them all at the same time. ## What's next? Measuring for large images is still slow. We should look at how to make that experience better. eg: Visual feedback that it's happening. eg: Try not to block the main UI thread. eg: Can we do anything in parallel? ### Change Type - [x] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [ ] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Draw some shapes. 2. Select them. 3. Copy/export as png. 4. Repeat with various sizes of shapes. eg: Select shapes over a large area, so that your exported image is larger than 8K resolution. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Android: Sped up exporting and importing images. |
||
---|---|---|
.github | ||
.husky | ||
.yarn | ||
apps | ||
assets | ||
config | ||
packages | ||
scripts | ||
.eslintignore | ||
.eslintplugin.js | ||
.eslintrc.js | ||
.gitignore | ||
.ignore | ||
.prettierignore | ||
.prettierrc | ||
.yarnrc.yml | ||
CHANGELOG.md | ||
CLA.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
lazy.config.ts | ||
lerna.json | ||
LICENSE.md | ||
package.json | ||
public-yarn.lock | ||
README.md | ||
TRADEMARKS.md | ||
vercel.json |
tldraw
Welcome to the public monorepo for tldraw. tldraw is a library for creating infinite canvas experiences in React. It's the software behind the digital whiteboard tldraw.com.
- Read the docs and learn more at tldraw.dev.
- Learn about our license.
Local development
To run the local development server, first clone this repo.
Install dependencies:
yarn
Start the local development server:
yarn dev
Open the example project at localhost:5420
.
License
tldraw's source code and distributed packages are provided under the non-commercial tldraw license.
This license does not permit commercial use. If you wish to use tldraw in a commercial product or enterprise, you will need to purchase a commercial license. To obtain a commercial license, please contact us at hello@tldraw.com.
To learn more, see our license page.
Trademarks
The tldraw name and logo are trademarks of tldraw. Please see our trademark guidelines for info on acceptable usage.
Community
Have questions, comments or feedback? Join our discord or start a discussion.
Contribution
Please see our contributing guide. Found a bug? Please submit an issue.
Contact
Find us on Twitter at @tldraw or email hello@tldraw.com. You can also join our discord for quick help and support.