hunkim98 / dotting

Dotting is a pixel art editor component library for react
https://hunkim98.github.io/dotting/
MIT License
43 stars 12 forks source link

Feature/improve extend #41

Closed hunkim98 closed 1 year ago

hunkim98 commented 1 year ago

🚀 [Related Issue: #4 ]

Preview

You can test the new extension algorithm in the PR preview page. Try to make the pixel grid very big and then test out the extension. The extension will not lag at all.


Changes

Improve extension algorithm to let the extension instantly happen


Notes


Next Up?

github-actions[bot] commented 1 year ago

PR Preview Action v1.4.4 :---: Preview removed because the pull request was closed. 2023-06-03 00:34 UTC

hunkim98 commented 1 year ago

Great job LGTM except for one question(though it is out of scope)

chrome-capture-2023-5-2 when extending + zooming the drawn pixels are not aligned with pan zoom' scale will this have to be fixed?

It seems that this problem is due to the data layer not rendering when extension happens. I have disabled the rendering of data layer when extension happens since there would be unnecessary renders when extension occurs. When extension happens, the data does not change, so we do not need to render the data layer.

You can check that logic in

https://github.com/hunkim98/dotting/blob/be330b6de919489c7e7b90aa893224784fcfedea/src/components/Canvas/Editor.tsx#L1842-L1865

If there is capturedData, it means that the current user is extending the grids. If that is the case, all layers except the data layer are rendered.

I will fix this by disabling pan zoom when extension happens. I believe it is rare for a user to extend the pixel grid while also zooming.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication