* feat: Add Eraser 🎉
* Eraser working
* remove unused state
* fix
* toggle eraser
* Support deselect with Alt/Option
* rename actionDelete -> actionErase
* Add util isEraserActive
* show eraser in mobile
* render eraser conditionally in mobile
* use selection if eraser in local storage state
* Add sampling to erase accurately
* use pointerDownState
* set eraser to false in AllowedExcalidrawElementTypes
* rename/reword fixes
* don't use updateScene
* handle bound text when erasing
* fix hover state in mobile
* consider all hitElements instead of a single
* code improvements
* revert to select if eraser active and elements selected
* show eraser in zenmode
* erase element when clicked on element while eraser active
* set groupIds to empty when eraser active
* fix test
* remove dragged distance
* feat: support custom colors 🎉
* remove canvasBackground
* fix tests
* Remove custom color when elements deleted
* persist custom color across sessions
* Choose 5 latest custom colors when populating from elements
* fix tests
* styling
* don't use up/down arrow for custom colors
* Always push latest color to the begining
* don't check if valid in custom color
* calculate custom colors on color picker open
* revert unnecessary changes
* remove newlines
* simplify state
* tweak label
* fix custom color shortcuts throwing if color not exists
* fix
* early return
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: Use dialog component for clear canvas instead of window confirm
* reduce font weight
* fix specs
* update button name and use action
* export clearCanvas from actions
* Use Theme type everywhere
* Rename Appearance type to Theme for consistency
* Reorder headers in readme
The host don't need to pass hardcoded strings any more and instead can use the exported constant
* feat: Add shortcuts for opening stroke and background color picker
* Use App.tsx keydown handler
* only get selectedElements if applicable (perf)
* fix tests and snaps
* reuse `appState.openMenu`
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: Support hiding save, save as, clear & export
* Remove canvasActions from state & minor changes
* Rename prop to UIOptions & pass default value
* Make requested changes
* better type checking so that optional check not needed at every point
* remove optional checks
* Add few tests
* Add describe block for canvasActions & use snapshot tests
* Add support for hiding canvas background picker
* Take snapshot of canvasActions instead of the whole app
* Add support for hiding dark mode toggle
* Update README.md
* Rename table heading
* Update changelog
* Make requested changes
* Update test name
* tweaks
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
* add zoom center action button
* enhance zoom calculation and scroll to center
* add zoom out and center button
* filter deleted elements
* improve complexity
* add key shortcut
* calculate zoom value
* don't render zoomCenter action
* offset from top to account for shape menu
* change shortcut & add to shortcut dialog
* decrease offset
* revert offset
* change hotkey & description
* rename to zoomToFit
* change shortcut label & position
Co-authored-by: dwelle <luzar.david@gmail.com>
* 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>
* feat: add reset zoom button
Add zoom reset button.
Button is shown only when zoom scale is different from 1
* change reset zoom icon
* always show zoom reset
* fix typo
* Initial support for mobile devices
No editing yet, but UI looks nice and you can open the canvas menu
* Add support for editing shape color, etc
* Allow the mobile menus to cover the shape selector
* Hopefully fix test error
* Fix touch on canvas
* Fix safe area handling & remove unused Island