964 Commits

Author SHA1 Message Date
David Luzar
59ec1c6cee
fix: zen-mode exit button not working () 2022-09-09 13:53:38 +02:00
Igor Berlenko
933c6a2237
build: add missing dependencies: pica, lodash ()
* add missing dependencies: pica, lodash

* remove lodash & fix yarn.lock

* first

* second

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-09-07 16:08:04 +05:30
zsviczian
cd61f31116
fix: buttons jump around on the mobile menu ()
Update MobileMenu.tsx
2022-09-05 16:00:47 +05:30
Aakansha Doshi
553b493f37
fix: library actions inside the sidebar () 2022-08-29 19:26:03 +05:30
Aakansha Doshi
8b7302e89e
fix: don't render library menu twice for mobile () 2022-08-29 15:44:10 +05:30
David Luzar
f9b7cfd8aa
fix: reintroduce help dialog button () 2022-08-27 23:02:17 +02:00
Aakansha Doshi
2b4462c941
refactor: reuse common ui dialogs and message for mobile and LayerUI ()
* refactor: Move common UI dialogs to component

* refactor

* fix
2022-08-26 11:46:34 +05:30
Aakansha Doshi
43b13d8e3a
fix: Add display name to components so it doesn't show as anonymous () 2022-08-26 11:46:19 +05:30
Aakansha Doshi
32d82219b1
refactor: Stats component ()
refactor: stats component
2022-08-22 17:18:25 +05:30
Aakansha Doshi
ba2c86fe1b
refactor: Move footer to its own component () 2022-08-22 16:09:24 +05:30
Aakansha Doshi
ec350ba8b2
feat: Introduce ExcalidrawElements and ExcalidrawAppState provider ()
* feat: Introduce ExcalidrawData provider so that app state and elements need not be passed to children

* fix

* fix zen mode

* Separate providers for data and elements

* pass appState and elements to layerUI

* pass appState and elements to selectedShapeActions

* pass appState and elements to MobileMenu

* pass appState to librarymenu

* rename

* rename to ExcalidrawAppState
2022-08-20 22:49:44 +05:30
Aakansha Doshi
32aa79164b
refactor: remove unused attribute hasHitElementInside from pointerDownState () 2022-08-18 19:11:18 +05:30
Aakansha Doshi
b5fd904808
fix: allow box selection of points when inside editor () 2022-08-18 19:07:14 +05:30
Aakansha Doshi
551c38f60b
fix: remove unnecessary conditions in pointerup for linear elements ()
* fix: remove unnecessary conditions in pointerup for linear elements

* reset editingLinearElement when clicked inside bounding box
2022-08-18 13:58:46 +05:30
Aakansha Doshi
38e8ae46c9
fix: check if hitting link in handleSelectionOnPointerDown ()
fix: check if hitting link in handleSelectionOnPoiinterDown
2022-08-18 13:40:26 +05:30
Aakansha Doshi
27cf5ed17e
fix: deselect linear element when clicked inside bounding box outside editor () 2022-08-16 23:05:38 +05:30
Aakansha Doshi
fd946adbae
refactor: cleanup renderScene ()
* refactor: cleanup renderScene

* pass object instead of individual params
2022-08-16 16:09:53 +05:30
Aakansha Doshi
5a8dbe8030
feat: show a mid point for linear elements ()
* feat: Add a mid point for linear elements

* fix tests

* show mid point only on hover

* hacky fix :(

* don't add mid points if present and only add outside editor

* improve styling and always show phantom point instead of just on hover

* fix tests

* fix

* only add polyfill for test

* add hover state for phantom point

* fix tests

* fix

* Add Array.at polyfill

* reuse `centerPoint()` helper

* reuse `distance2d`

* use `Point` type

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-08-11 20:16:25 +05:30
Aakansha Doshi
731093f631
fix: show bounding box for 3 or more linear point elements ()
* fix: show bounding box for 3+ linear point elements

* refactor

* show bounding box for 3 points as well

* fix dragging bounding box for linear elements

* Increase margin/padding for linear elements

* fix cursor and keep bounding box same but offset resize handles

* introduce slight padding for selection border

* better

* add constant for spacing
2022-08-10 21:42:28 +05:30
Aakansha Doshi
fe56975f19
fix: cleanup the condition for dragging elements () 2022-08-10 15:32:40 +05:30
Ryan Di
b818df1098
feat: lock angle when editing linear elements with shift pressed ()
Co-authored-by: Ryan <diweihao@bytedance.com>
2022-08-04 22:42:31 +00:00
David Luzar
4359e2935d
fix: line deselected when shift-dragging point outside editor () 2022-08-05 00:01:56 +05:30
Aakansha Doshi
08ce7c7fc3
feat: redesign linear elements 🎉 ()
* feat: redesign arrows and lines

* set selectedLinearElement on pointerup

* fix tests

* fix lint

* set selectionLinearElement to null when element is not selected

* fix

* don't set selectedElementIds to empty object when linear element selected

* don't move arrows when clicked on bounding box

* don't consider bounding box when linear element selected

* better hitbox

* show pointer when over the points in linear elements

* highlight points when hovered

* tweak design whene editing linear element points

* tweak

* fix test

* fix multi point editing

* cleanup

* fix

* fix

* remove stroke when hovered

* account for zoom when hover

* review fix

* set selectedLinearElement to null when selectedElementIds doesn't contain the linear element

* remove hover affect when moved away from linear element

* don't set selectedLinearAElement if already set

* fix selection

* render reduced in test :p

* fix box selection for single linear element

* set selectedLinearElement when deselecting selected elements and linear element is selected

* don't show linear element handles when element locked

* selected linear element when only linear present and selected with selectAll

* don't set selectedLinearElement if already set

* store selectedLinearElement in browser to persist

* remove redundant checks

* test fix

* select linear element handles when user has finished multipoint editing

* fix snap

* add comments

* show bounding box for locked linear elements

* add stroke param to fillCircle and remove stroke when linear element point hovered

* set selectedLinearElement when thats the only element left when deselcting others

* skip tests instead of removing for rotation

* (un)bind on pointerUp when moving linear element points outside editor

* render bounding box for linear elements as a fallback on state mismatch

* simplify and remove type assertion

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-08-03 20:58:17 +05:30
Ryan Di
865d29388c
feat: cursor alignment when creating linear elements with shift pressed ()
* feat: cursor alignment when creating linear elements

* feat: apply cursor alignment to multi-point linear elements

* refactor: rename size helper function
2022-08-02 15:43:19 +05:30
José dBruxelles
54c7ec416a
fix: Add title attribute to the modal close button ()
Add `title` attribute to the modal close button
2022-08-02 11:42:47 +05:30
zsviczian
aca284057d
fix: Context menu positioning when component has offsets ()
Update Popover.tsx
2022-08-02 11:38:55 +05:30
Ryan Di
2820cd112e
feat: shift-clamp when creating multi-point lines/arrows ()
Co-authored-by: Ryan <diweihao@bytedance.com>
2022-08-01 15:41:50 +02:00
Aakansha Doshi
3d5356cb8e
fix: use flushSync when moving line editor since we need to read previous value after setting state ()
* fix: use flushSync when moving line editor since we need to read previous value after setting state

* add comment
2022-07-29 19:27:37 +05:30
Aakansha Doshi
46f5ce5ce0
fix: useLayout effect cleanup in dev mode for charts () 2022-07-29 17:25:26 +05:30
Aakansha Doshi
91fc22182c
fix: revert browser toast for high/low zoom () 2022-07-27 20:49:29 +05:30
Aakansha Doshi
339212e563
refactor: remove unnecessary if condition for linear element onKeyDown ()
* refactor: remove unnecessary if condition for linear element onKeyDown

* fix
2022-07-26 16:33:13 +05:30
Aakansha Doshi
58845e450a
fix: Use React.FC as react-dom is not able to infer types of Modal () 2022-07-22 13:09:15 +05:30
Aakansha Doshi
15d79f8fee
chore: upgrade to React 18 ()
* chore: upgrade to React 18

* better type

* use React.FC to fix type

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-07-22 11:20:36 +05:30
Shubham Shah
958ebeae61
feat: make context menu scrollable ()
* Make context menu scrollable

* Fix color picker not showing up

* Fix overflow cuts shadow

* style fixes

* fix

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2022-07-21 14:34:49 +02:00
Gwenaël Gallon
c5cadc7de3
fix: missing translation for "Scale" to Export Dialog ()
fix: missing translation for "Scale"
2022-07-20 14:52:04 +05:30
David Luzar
a7937681e9
fix: account for safe area for floating buttons on mobile () 2022-07-19 15:44:14 +02:00
David Luzar
792f238d16
refactor: improve typing & check () 2022-07-19 15:44:04 +02:00
Aakansha Doshi
6e0ac52a64
fix: check for ctrl key when wheel event triggered to only disable zooming ()
* fix: check for ctrl key when wheel event triggered to only disable zooming

* remove newline
2022-07-18 14:39:55 +05:30
David Luzar
5bc40402a6
fix: disable render throttling by default & during resize () 2022-07-16 11:36:55 +02:00
Aakansha Doshi
df14c69977
refactor: don't pass zenModeEnable, viewModeEnabled and toggleZenMode props to LayerUI ()
refactor: don't pass zenModeEnabled and viewModeEnabled props to LayerUI
2022-07-14 16:13:10 +05:30
Aakansha Doshi
1ea67ba93d
fix: attach wheel event to exscalidraw container only () 2022-07-14 11:08:20 +05:30
Aakansha Doshi
a7153d9d1d
feat: update toast api to account for duration and closable ()
* feat: update toast api to account for duration and closable

* fix

* update snaps

* update docs

* male toast nullable

* fix snaps

* remove clearToast from App.tsx and replace clearToast prop in Toast comp with onClose
2022-07-11 18:11:13 +05:30
Aakansha Doshi
7efa081976
fix: show toast when browser zoom is not 100% ()
* fix: show toast when browser zoom is not 100%

* update threshold for detecting zoom

* Make toast permanent for browser zoom

* check if browser zoomed on mount

* retrieve toast params from function getToastParams

* Revert "retrieve toast params from function getToastParams"

This reverts commit cfca580d74c0261c3706f577db5ba7f2213cdce8.
2022-07-08 19:19:00 +05:30
Aakansha Doshi
5deb93a083
fix: prevent browser zoom inside Excalidraw ()
* fix: prevent browser zoom inside Excalidraw

* prevent default only for =/-
2022-07-08 17:53:40 +05:30
David Luzar
b6bb74d08d
feat: throttle scene rendering to animation framerate () 2022-07-07 11:47:37 +02:00
Aakansha Doshi
76a5bb060e
feat: make toast closable and allow custom duration ()
* feat: make toast closable and allow custom duration

* use Infinity to keep prevent auto close

* rename to DEFAULT_TOAST_TIMEOUT and move to toast.tsx

* fix

* set closable as false by default and fix design

* tweak css

* reuse variables

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-07-05 21:43:59 +05:30
David Luzar
dac8dda4d4
feat: collab component state handling rewrite & fixes () 2022-07-05 16:03:40 +02:00
David Luzar
120c8f373c
fix: library not scrollable when no published items installed ()
* fix: library not scrollable when no published items installed

* show empty lib message in one case & fix i18n
2022-06-25 20:10:53 +02:00
David Luzar
af31e9dcc2
fix: focus traps inside popovers () 2022-06-23 17:33:50 +02:00
David Luzar
50bc7e099a
fix: unable to use cmd/ctrl-delete/backspace in inputs () 2022-06-23 17:27:15 +02:00