* rotate rectanble with fixed angle
* rotate dashed rectangle with fixed angle
* fix rotate handler rect
* fix canvas size with rotation
* angle in element base
* fix bug in calculating canvas size
* trial only for rectangle
* hitTest for rectangle rotation
* properly resize rotated rectangle
* fix canvas size calculation
* giving up... workaround for now
* **experimental** handler to rotate rectangle
* remove rotation on copy for debugging
* update snapshots
* better rotation handler with atan2
* rotate when drawImage
* add rotation handler
* hitTest for any shapes
* fix hitTest for curved lines
* rotate text element
* rotation locking
* hint messaage for rotating
* show proper handlers on mobile (a workaround, there should be a better way)
* refactor hitTest
* support exporting png
* support exporting svg
* fix rotating curved line
* refactor drawElementFromCanvas with getElementAbsoluteCoords
* fix export png and svg
* adjust resize positions for lines (N, E, S, W)
* do not make handlers big on mobile
* Update src/locales/en.json
Alright!
Co-Authored-By: Lipis <lipiridis@gmail.com>
* do not show rotation/resizing hints on mobile
* proper calculation for N and W positions
* simplify calculation
* use "rotation" as property name for clarification (may increase bundle size)
* update snapshots excluding rotation handle
* refactor with adjustPositionWithRotation
* refactor with adjustXYWithRotation
* forgot to rename rotation
* rename internal function
* initialize element angle on restore
* rotate wysiwyg editor
* fix shift-rotate around 270deg
* improve rotation locking
* refactor adjustXYWithRotation
* avoid rotation degree becomes >=360
* refactor with generateHandler
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
* Don't reset cache while zooming using a gesture
This reuses the cached canvas while the gesture is happening. Once it has stop updating, then recompute the cache with the proper zoom.
This should massively improve performance when panning on big scenes on mobile
Fixes#1056
* update snapshot tests
* Fix hit testing threshold
- The bounding box was not correctly extended to take into account the threshold. It was only for y axis but not x.
- The bezier threshold was using 20 instead of 10 and not taking into account zoom level.
Both those issues are fixed and now the behavior looks good on all the shapes I can test.
* fix_tests
* Get rid of isSelected, canvas, canvasZoom, canvasOffsetX and canvasOffsetY on ExcalidrawElement.
* Fix most unit tests. Fix cmd a. Fix alt drag
* Focus on paste
* shift select should include previously selected items
* Fix last test
* Move this.shape out of ExcalidrawElement and into a WeakMap
* Initial factoring out of parts of the LayerUI component
2360 → 2224 LOC
* Create a Section component
* Break up src/index.tsx
* Refactor actions to reduce duplication, fix CSS
Also consolidate icons
* Move scene/data.ts to its own directory
* Fix accidental reverts, banish further single-character variables
* ACTIVE_ELEM_COLOR → ACTIVE_ELEMENT_COLOR
* Further refactoring the icons file
* Log all errors
* Pointer Event polyfill to make the tests work
* add test hooks & fix tests
Co-authored-by: dwelle <luzar.david@gmail.com>
* Add touch support
* Mock media query
* Mock media query pt 2
* Fix tests
* Allow installing as an app on iOS
* Fix type error
* Math.hypot
* delete and finalize buttons, hint viewer
* skip failing tests
* skip the rest of the failing tests
* Hide the selected shape actions when nothing is selected
* Don’t go into mobile view on short-but-wide viewports
* lol
* Scaffold a simple test case for debugging
* Set up Jest environment that works with React
- Install and set up react-testing-library
- "Unignore" roughjs and browser-nativejs transformations
- Separate App component from ReactDOM
* Write first passing test
- Mock canvas
- Remove App file and mount/unmount ReactDOM on import
* Add tests for drag create behavior
* Fix comments in dragCreate
* Pin jest-mock-canvas dependency
* Remove dependency range for testing library
* Add tests for multi point mode and selection element
* Fix all tests due to decrease in updates to canvas when changing tools
* Disable state updates if component is unmounted
- Remove all event listeners
- Disable storing scene in state if component is unmounted
* Add tests for move and element selection
* Merge branch 'master' into add-integration-tests
* Add tests for resizing rectangle
* move unmounted check to syncActionResult method
* Use a custom test renderer instead of default testing-library functions
* Add custom query for selecting tools
* move files around
Co-authored-by: David Luzar <luzar.david@gmail.com>