* 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>
* Add a icon for dulplication
* Add PanelComponent for duplication
* Add duplicate button for mobile
* Add styles for layout action buttons
* Add a translation for 'Actions'
* Show left action buttons only for desktop
* Add duplicate button at the bottom of mobile
It is provided depending on whether or not it is `multiElement` to maintain space between buttons.
Fixes#1115
The issue is that replaceAllElements calls a render synchronously, preventing lastBroadcastedOrReceivedSceneVersion from being set correctly.
I tried using batchUpdate but it only takes a single argument ( c5d2fc7127/packages/react-reconciler/src/ReactFiberWorkLoop.js (L1088) ) whereas the callback takes two.
Test Plan:
- Add a console.log before `this.broadcastScene("SCENE_UPDATE");` in App.tsx
- Connect a bunch of clients
- Have one move a shape
- Make sure that this client has the console logged
- Make sure the other clients don't have it
The logic to support it was not implemented. This is not the prettiest way to solve it in the world but it does work. Some more refactoring here is probably warranted.
Fixes#1039
* 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
This wasn't taking into account zoom properly.
The logic should probably get refactored a bit, it's not ideal that we're passing canvas, state and scale as different arguments. Also it's weird that the function that returns the center is computing the viewport translation. But I'm not motivated enough to fix it right now...
Fixes#1100
* load scene from localStorage in collaboration if user is first in room
* load scene from localStorage in collaboration prior to syncing with server
* fix merge
Co-authored-by: dwelle <luzar.david@gmail.com>
* Update shortcuts.md for Lock
* Add 'Q' as a shortcut for toggling shape lock
* Add shortcut to LockIcon title
* use event.key instead
Co-authored-by: Faustino Kialungila <Faustino.kialungila@gmail.com>
* Restyle the bottom bar on mobile as an Island
* Shorter label for collaboration button, truncate too-long button labels
* Refactor safe area things to global vars
* Fix scroll bar positioning, don’t block scrollbars with menu island
* Update text
* [WIP] Add names next to pointers
This implements the rendering and messaging across. Still need to do the UI to set the name.
Also, not really sure what's the best place to send the name and store it.
* Add randomized names
Co-authored-by: Christopher Chedeau <vjeux@fb.com>
My original hack to put the scale when we create the canvas element doesn't make much sense. It should be done when we are rendering the scene. I moved it there in this PR.
The rest was all about forwarding the scale to where it's needed.