* feat: Word wrap inside rect and increase height when size exceeded
* fixes for auto increase in height
* fix height
* respect newlines when wrapping text
* shift text area when height increases beyond mid rect height until it reaches to the top
* select bound text if present when rect selected
* mutate y coord after text submit
* Add padding of 30px and update dimensions acordingly
* Don't allow selecting bound text element directly
* support deletion of bound text element when rect deleted
* trim text
* Support autoshrink and improve algo
* calculate approx line height instead of hardcoding
* use textContainerId instead of storing textContainer element itself
* rename boundTextElement -> boundTextElementId
* fix text properties not getting reflected after edit inside rect
* Support resizing
* remove ts ignore
* increase height of container when text height increases while resizing
* use original text when editing/resizing so it adjusts based on original text
* fix tests
* add util isRectangleElement
* use isTextElement util everywhere
* disable selecting text inside rect when selectAll
* Bind text to circle and diamond as well
* fix tests
* vertically center align the text always
* better vertical align
* Disable binding arrows for text inside shapes
* set min width for text container when text is binded to container
* update dimensions of container if its less than min width/ min height
* Allow selecting of text container for transparent containers when clicked inside
* fix test
* preserve whitespaces between long word exceeding width and next word
Use word break instead of whitespace no wrap for better readability and support safari
* Perf improvements for measuring text width and resizing
* Use canvas measureText instead of our algo. This has reduced the perf ~ 10 times
* Rewrite wrapText algo to break in words appropriately and for longer words
calculate the char width in order unless max width reached. This makes the
the number of runs linear (max text length times) which was earlier
textLength * textLength-1/2 as I was slicing the chars from end until max width reached for each run
* Add a util to calculate getApproxCharsToFitInWidth to calculate min chars to fit in a line
* use console.info so eslint doesnt warn :p
* cache char width and don't call resize unless min width exceeded
* update line height and height correctly when text properties inside container updated
* improve vertical centering when text properties updated, not yet perfect though
* when double clicked inside a conatiner take the cursor to end of text same as what happens when enter is pressed
* Add hint when container selected
* Select container when escape key is pressed after submitting text
* fix copy/paste when using copy/paste action
* fix copy when dragged with alt pressed
* fix export to svg/png
* fix add to library
* Fix copy as png/svg
* Don't allow selecting text when using selection tool and support resizing when multiple elements include ones with binded text selectec
* fix rotation jump
* moove all text utils to textElement.ts
* resize text element only after container resized so that width doesnt change when editing
* insert the remaining chars for long words once it goes beyond line
* fix typo, use string for character type
* renaming
* fix bugs in word wrap algo
* make grouping work
* set boundTextElementId only when text present else unset it
* rename textContainerId to containerId
* fix
* fix snap
* use originalText in redrawTextBoundingBox so height is calculated properly and center align works after props updated
* use boundElementIds and also support binding text in images 🎉
* fix the sw/se ends when resizing from ne/nw
* fix y coord when resizing from north
* bind when enter is pressed, double click/text tool willl edit the binded text if present else create a new text
* bind when clicked on center of container
* use pre-wrap instead of normal so it works in ff
* use container boundTextElement when container present and trying to edit text
* review fixes
* make getBoundTextElementId type safe and check for existence when using this function
* fix
* don't duplicate boundElementIds when text submitted
* only remove last trailing space if present which we have added when joining words
* set width correctly when resizing to fix alignment issues
* make duplication work using cmd/ctrl+d
* set X coord correctly during resize
* don't allow resize to negative dimensions when text is bounded to container
* fix, check last char is space
* remove logs
* make sure text editor doesn't go beyond viewport and set container dimensions in case it overflows
* add a util isTextBindableContainer to check if the container could bind text
* implement line editing
* line editing with rotation
* ensure adding new points is disabled on point dragging
* fix hotkey replacement
* don't paint bounding box when creating new multipoint
* tweak points style, account for zoom and z-index
* don't persist editingLinearElement to localStorage
* don't mutate on noop points updates
* account for rotation when adding new point
* ensure clicking on points doesn't deselect element
* tweak history handling around editingline element
* update snapshots
* refactor pointerMove handling
* factor out point dragging
* factor out pointerDown
* improve positioning with rotation
* revert to use roughjs for calculating points bounds
* migrate from storing editingLinearElement.element to id
* make GlobalScene.getElement into O(1)
* use Alt for adding new points
* fix adding and deleting a point with rotation
* disable resize handlers & bounding box on line edit
Co-authored-by: daishi <daishi@axlight.com>
* add NonDeleted
* make test:all script run tests without prompt
* rename helper
* replace with helper
* make element contructors return nonDeleted elements
* cache filtered elements where appliacable for better perf
* rename manager element getter
* remove unnecessary assertion
* fix test
* make element types in resizeElement into nonDeleted
Co-authored-by: dwelle <luzar.david@gmail.com>
* experiment resizing multiple elements
* hack common component
* calculate scale properly (still se only)fg
* prioritize multi selection
* take handle offset into calculation
* fix master merge
* refactor resizeElements out from App
* wip: handlerRectanglesFromCoords
* fix test with type assertion
* properly show handles wip
* revert previous one and do a tweak
* remove unnecessary assignments
* replace hack code with good one
* refactor coords in arg
* resize NW
* resize from sw,ne
* fix with setResizeHandle
* do not show hint while resizing multiple elements
* empty commit
* fix format
* 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>
* 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
* Make Undo & Redo and the menu buttons into actions; add undo/redo buttons
* Create variables for the ToolIcon colors
* Darken the menu buttons when they’re active
* Put the more intensive test in `perform`
* Fix & restyle hint viewer
* Add pinch zoom for macOS Safari
* Chrome/Firefox trackpad pinch zoom
* openedMenu → openMenu
* needsShapeEditor.ts → showSelectedShapeActions.ts
* Call showSelectedShapeActions
* Add Hint viewer
- Add hints for arrows and lines
- Add hints for resizing elements
* Swap priority of multi mode and resize mode in Hint Viewer
* Remove dangling locales from public
* Add shortcut to hide hints
* Change hint texts and show resize hint ONLY during resizing
* Remove hints toggling