* fix: Replaced KeyboardEvent.code with KeyboardEvent.key for all letters
* fix: reverted all keybindings that included alt to use code instead of keys
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
* feat: support segment midpoints in line editor
* fix tests
* midpoints working in bezier curve
* midpoint working with non zero roughness
* calculate beizer curve control points for points >2
* unnecessary rerender
* don't show phantom points inside editor for short segments
* don't show phantom points for small curves
* improve the algo for plotting midpoints on bezier curve by taking arc lengths and doing binary search
* fix tests finally
* fix naming
* cache editor midpoints
* clear midpoint cache when undo
* fix caching
* calculate index properly when not all segments have midpoints
* make sure correct element version is fetched from cache
* chore
* fix
* direct comparison for equal points
* create arePointsEqual util
* upate name
* don't update cache except inside getter
* don't compute midpoints outside editor unless 2pointer lines
* update cache to object and burst when Zoom updated as well
* early return if midpoints not present outside editor
* don't early return
* cleanup
* Add specs
* fix
* 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>
* 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>
* 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
* fix: use excalidraw asset path in fonts when exporting
* fix
* fix
* introduce env variables and determine asset path correctly
* fix snaps
* use env vars to determine pkg name and version
* update docs
* quotes
* naming tweaks
* do not mark local element as duplicate when there's no remote counterpart
* merge instead of overwrite elements when saving to firebase & reconcile local state
* decouple syncing from persistence
* fix ts
* clarify doc
* fix reconciliation not removing duplicates
* 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
* chore: Add tracking for hyperlinks
* update
* fix
* remove
* tweak
* disable ga logging in dev again
* add logging for hyperlink `edit` & support for tracking in manager
* event label tweaks
* fix tests & make more typesafe
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: Support hypelinks
* dont show edit when link not present
* auto submit on blur
* Add link button in sidebar and do it react way
* add key to hyperlink to remount when element selection changes
* autofocus input
* remove click handler and use pointerup/down to show /hide popup
* add keydown and support enter/escape to submit
* show extrrnal link icon when element has link
* use icons and open link in new tab
* dnt submit unless link updated
* renamed ffiles
* remove unnecessary changes
* update snap
* hide link popup once user starts interacting with element and show again only if clicked outside and clicked on element again
* render link icon outside the element
* fix hit testing
* rewrite implementation to render hyperlinks outside elements and hide when element selected
* remove
* remove
* tweak icon position and size
* rotate link icon when element rotated, handle zooming and render exactly where ne resize handle is rendered
* no need to create a new reference anymore for element when link added/updated
* rotate the link image as well when rotating element
* calculate hitbox of link icon and show pointer when hovering over link icon
* open link when clicked on link icon
* show tooltip when hovering over link icon
* show link action only when single element selected
* support other protocols
* add shortcut cmd/ctrl+k to edit/update link
* don't hide popup after submit
* renderes decreased woo
* Add context mneu label to add/edit link
* fix tests
* remove tick and show trash when in edit mode
* show edit view when element contains link
* fix snap
* horizontally center the hyperlink container with respect to elemnt
* fix padding
* remove checkcircle
* show popup on hover of selected element and dismiss when outside hitbox
* check if element has link before setting popup state
* move logic of auto hide to hyperlink and dnt hide when editing
* hide popover when drag/resize/rotate
* unmount during autohide
* autohide after 500ms
* fix regression
* prevent cmd/ctrl+k when inside link editor
* submit when input not updated
* allow custom urls
* fix centering of popup when zoomed
* fix hitbox during zoom
* fix
* tweak link normalization
* touch hyperlink tooltip DOM only if needed
* consider 0 if no offsetY
* reduce hitbox of link icon and make sure link icon doesn't show on top of higher z-index elements
* show link tooltip only if element has higher z-index
* dnt show hyperlink popup when selection changes from element with link to element with no link and also hide popover when element type changes from selection to something else
* lint: EOL
* fix link icon tooltip positioning
* open the link only when last pointer down and last pointer up hit the link hitbox
* render tooltip after 300ms delay
* ensure link popup and editor input have same height
* wip: cache the link icon canvas
* fix the image quality after caching using device pixel ratio yay
* some cleanup
* remove unused selectedElementIds from renderConfig
* Update src/renderer/renderElement.ts
* fix `opener` vulnerability
* tweak styling
* decrease padding
* open local links in the same tab
* fix caching
* code style refactor
* remove unnecessary save & restore
* show link shortcut in help dialog
* submit on cmd/ctrl+k
* merge state props
* Add title for link
* update editview if prop changes
* tweak link action logic
* make `Hyperlink` compo editor state fully controlled
* dont show popup when context menu open
* show in contextMenu only for single selection & change pos
* set button `selected` state
* set contextMenuOpen on pointerdown
* set contextMenyOpen to false when action triggered
* don't render link icons on export
* fix tests
* fix buttons wrap
* move focus states to input top-level rule
* fix elements sharing `Hyperlink` state
* fix hitbox for link icon in case of rect
* Early return if hitting link icon
Co-authored-by: dwelle <luzar.david@gmail.com>