* fix: Reinforce fixedPoint restore
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Even more hardened boundElement in restore
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Extract constant
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Remove superfluous check from restore
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove non-needed code path
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: More robust number test for fixedPoint parsing
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Validate bindings for element being parsed
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* unrelated type safety
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat(editor): allow laser pointing in view mode
* feat: allow switching between laser/hand in view mode
* fix lint
* factor out to utils
* fix: only handle primary clicks with the selection/laser tools
* fix(arrow): Overlap arrow behavior
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat(editor): reduce binding gap (#10739)
* feat(editor): reduce binding gap to 7px
* feat(editor): reduce binding gap to 5px
* feat(editor): reduce binding gap to 3px
* go back to 5px
* update tests
* feat: Simplified update bind points
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Remove non-needed export
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix. Possessed arrows #1
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Focus point projection stabilization
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Remove arrow stability hack
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Unbound other endpoint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat(editor): visualize binding midpoints + support for simple arrows (#10611)
* feat: Force exact center focus point
When the projected point is close to center snap it to the exact center.
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Snap to center around side mid point.
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Trigger CI
* fix: Midpoint outline focus point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Dragging existing arrow reset focus point on outline
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Midpoint indicator
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Rotated mid points
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: No hole
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Cache hits and scene lookups
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove debug
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Consider hit threshold and inside override too
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Increase outline midpoint sticky distance
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Don't show midpoint indicator when no snapping is possible
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Indicate lock-in
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove Map caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: incorrect threshold
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: threshold setting
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hit caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Simple arrow mid point selection inconsistency
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: cache override
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Precise know dragging with midpoint refactor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fear: Frame support
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Crossing arrow won't trigger mid point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow creation point highlight
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Restore types & tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Restore restore.ts
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: restore.ts
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Elbow arrows reliably highlight center point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Highlight point ordering
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Bind with focus point across shape
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
* fix: Midpoint and binding alignment
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Indicator color
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: More knob tuning
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Radius
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* simplify point indicators
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Snapshots
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Target point selection
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove non-needed change
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Try again removing non-needed modification
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Inside-inside binding arrow endpoint drag trigger focus point editor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Area based edge case
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Overlapping new arrow jump
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
* feat: Force exact center focus point
When the projected point is close to center snap it to the exact center.
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Snap to center around side mid point.
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Trigger CI
* fix: Midpoint outline focus point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Dragging existing arrow reset focus point on outline
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Midpoint indicator
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Rotated mid points
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: No hole
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Cache hits and scene lookups
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove debug
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Consider hit threshold and inside override too
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Increase outline midpoint sticky distance
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Don't show midpoint indicator when no snapping is possible
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Indicate lock-in
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove Map caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: incorrect threshold
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: threshold setting
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hit caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Simple arrow mid point selection inconsistency
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: cache override
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Precise know dragging with midpoint refactor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fear: Frame support
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Crossing arrow won't trigger mid point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow creation point highlight
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Restore types & tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Restore restore.ts
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: restore.ts
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Elbow arrows reliably highlight center point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Highlight point ordering
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Bind with focus point across shape
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
* fix: Midpoint and binding alignment
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Indicator color
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: More knob tuning
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Radius
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* simplify point indicators
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Arrow update when cloned
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat(editor): reduce binding gap (#10739)
* feat(editor): reduce binding gap to 7px
* feat(editor): reduce binding gap to 5px
* feat(editor): reduce binding gap to 3px
* go back to 5px
* update tests
* chore: Refactor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Align focus points
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
* fix: Other binding converted from fixed to orbit unconditionally
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: New arrow creation
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt point setting on inside binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Initial arrow creation with Alt
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat(editor): reduce binding gap to 7px
* feat(editor): reduce binding gap to 5px
* feat(editor): reduce binding gap to 3px
* go back to 5px
* update tests
* feat: Focus indicator
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Snapshot update
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Move visualdebug to utils and introduce volume bindable volume visualization
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Move visualdebug to elements
Due to dep circles
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Possible test timeout
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Incorrect hit test point input
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Add fallback when dragged outside of allowed area
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Elbow arrows don't need focus point mgmt
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: End bound indirect fix
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Show indicator when arrow endpoint dragging
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Update bound arrow endpoint at mid-point drag
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Refactor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Curve endpoint intersection
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Outline focus point is reset on existing arrow drag
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Fix lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Dragging focus point off
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Don't show the focus indicator when arrow endpoint is dragged
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Drag area for focus handles
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Focus point size unified
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Size bump for focus knob
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Cache hits and scene lookups
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove debug
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Consider hit threshold and inside override too
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Other shape switching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* perf: Update tolerance params
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Focus know line width
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: knob offset
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Full overlap
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove Map caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: incorrect threshold
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: threshold setting
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hit caching
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: cache override
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Snapshots
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Redesigned focus point handling
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Inside-inside mode
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove comment
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Allow focus knob outside the shape
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow endpoint offset
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Focus knob element distance
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Increase iteration on curve intersection calc
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Handle disabled binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt mode
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Nested shape focus rewrite
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt + Ctrl + arrow endpoitn
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hit ordering for focus points
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Focus point visibility
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* dry out renderFocusPointIndicator
* do not higlight point when dragging & make focus point smaller
* optimize retrieval of selectedLinearElement
* move focus highlighting into renderFocusPointIndicator to DRY out and colocate
* remove `disabled` state from focus highlight
* make focus point stroke color less prominent
* fix: No focus point for multi-point arrows
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow edit mode drag focus point release
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* DRY out arrow point-like drag
* move `focus.ts` to `arrows/focus.ts`
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Line history
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: More conservative condition
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Move visualdebug to utils and introduce volume bindable volume visualization
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Move visualdebug to elements
Due to dep circles
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: add constants and side methods to packages
* add transform to the element package
* lint
* remove dead code
* put transform types back to transform.ts
* fix imports
* fix imports in test
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Corner jumping
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hints
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: No corner avoidance for simple arrows
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* show alt/cmd hint when creating/moving arrow point any time
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* Fixed point binding for simple arrows
Tests added
Fix binding
Remove unneeded params
Unfinished simple arrow avoidance
Fix newly created jumping arrow when gets outside
Do not apply the jumping logic to elbow arrows for new elements
Existing arrows now jump out
Type updates to support fixed binding for simple arrows
Fix crash for elbow arrws in mutateElement()
Refactored simple arrow creation
Updating tests
No confirm threshold when inside biding range
Fix multi-point arrow grid off
Make elbow arrows respect grids
Unbind arrow if bound and moved at shaft of arrow key
Fix binding test
Fix drag unbind when the bound element is in the selection
Do not move mid point for simple arrows bound on both ends
Add test for mobing mid points for simple arrows when bound on the same element on both ends
Fix linear editor bug when both midpoint and endpoint is moved
Fix all point multipoint arrow highlight and binding
Arrow dragging gets a little drag to avoid accidental unbinding
Fixed point binding for simple arrows when the arrow doesn't point to the element
Fix binding disabled use-case triggering arrow editor
Timed binding mode change for simple arrows
Apply fixes
Remove code to unbind on drag
Update simple arrow fixed point when arrow is dragged or moved by arrow keys
Binding highlight fixes
Change bind mode timeout logic
Fix tests
Add Alt bindMode switch
No dragging of arrows when bound, similar to elbow
Fix timeout not taking effect immediately
Bumop z-index for arrows when dragged
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Only transparent bindables allow binding fallthrough
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix point click array creation interaction with fixed point binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Restrict new behavior to arrows only
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Allow binding inside images
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix already existing fixed binding retention
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Refactor and implement fixed point binding for unfilled elements
Restore drag
Removed point binding
Binding code refactor
Added centered focus point
Binding & focus point debug
Add invariants to check binding integrity in elements
Binding fixes
Small refactors
Completely rewritten binding
Include point updates after binding update
Fix point updates when endpoint dragged and opposite endpoint orbits
centered focus point only for new arrows
Make z-index arrow reorder on bind
Turn off inside binding mode after leaving a shape
Remove invariants from debug
feat: expose `applyTo` options, don't commit empty text element (#9744)
* Expose applyTo options, skip re-draw for empty text
* Don't commit empty text elements
test: added test file for distribute (#9754)
z-index update
Bind mode on precise binding
Fix binding to inside element
Fix initial arrow not following cursor (white dot)
Fix elbow arrow
Fix z-index so it works on hover
Fix fixed angle orbiting
Move point click arrow creation over to common strategy
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Add binding strategy for drag arrow creation
Fix elbow arrow
Fix point handles
Snap to center
Fix transparent shape binding
Internal arrow creation fix
Fix point binding
Fix selection bug
Fix new arrow focus point
Images now always bind inside
Flashing arrow creation on binding band
Add watchState debug method to window.h
Fix debug canvas crash
Remove non-needed bind mode
Fix restore
No keyboard movement when bound
Add actionFinalize when arrow in edit mode
Add drag to the Stats panel when bound arrow is moved
Further simplify curve tracking
Add typing to action register()
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix point at finalize
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix type errors
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
New arrow binding rules
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix cyclical dep
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix jiggly arrows
Fix jiggly arrow x2
Long inside-other binding
Click-click binding
Fix arrows
Performance
[PERF] Replace in-place Jacobian derivation with analytical version
Different approach to inside binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fixes
Fix inconsistent arrow start jump out
Change how images are bound to on new arrow creation
Lower timeout
Small insurance fix
Fix curve test
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
No center focus point
90% inside center binding
Fixing tests
fix: Elbow arrow fixes
fix: More arrow fixes
Do not trigger arrow binding for linear elements
fix: Linear elements
fix: Refactor actionFinalize for linear
Binding tests updated
fix: Jump when cursor not moved
fix: history tests
Fix history snapshot
Fix undo issue
fix(eraser): Remove binding from the other element
fix(tests): Update tests
chore: Attempt filtering new set state
Fix excessive history recording
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix all tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
fix(transform): Fix group resize and rotate
fix(binding): Harmonize binding param usage
fix: Center focus point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
chore: Trigger build
Remove binding gap
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Binding highlight refactor
fix: Refactored timeout bind mode handling
fix: Center when orbiting
feat: Color change on highlight
Fix orbit binding highlight
fix: hiding arrow
Fix arrow binding
Fix arrow drag selection logic
Binding highlight is now hot pink
Change inside binding logic for start point
Render focus point in debug mode
Fix snap to center
Fix actionFinalize for new arrow creation
fix: snapToCenter()
80% by length
fix: attempt at fixing the dancing arrows
feat: No center snap when start is not bound
Fix centering for existing arrows
tweak binding highlight color
change `appState.suggestedBindings` -> `suggestedBinding` & remove unused code
Refactor delayed bind mode change
Binding highlight rotation support + image support
fix(highlight): Overdraw fixes
feat: Do not allow drag bound arrow closer to the shape than dragging distance
feat: Stroke width adaptive fixed binding distance
chore: More point dragging centralization
New element behavior
Refactor dragging
Fix incorrect highlight sizing
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix delayed bind mode for multiElement arrows
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix multi-point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fix elbow arrows
Simplify state
Small positional fixes
Fix jiggly arrows
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Fixes for arrow dragging
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Elbow arrow fixes
Highlight fixes
Fix elbow arrow binding
Frame highlight
Fix elbow mid-point binding
Fix binding suggestion for disabled binding state
Implement Alt
Remove debug
* CHange new arrow creation
* fix: allow inside binding via timeout if arrow has no startBinding
* fix: Delete invariant violation with arrows
* fix: Deleted arrow causes problems
* fix: Dragging issues
* fix: Dragging fix 2
* fix: Disable drag drag when arrow is bound
* fix: Multipoint arrow opposite point movement
* fix: Ctrl+Alt precedence
* feat: Alt inside start binding mode change
* Fix multipoint arrow orbit
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow start inside binding switch
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: New arrow never binds inside
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Small refactor
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Multi-point arrows and linears
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Nested shapes handling
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Overlap behavior
* Alt unbind fix
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Existing arrow nested bindable
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Binding suggestions
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Circular dep
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: snapshots
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt immediate update
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Laxing on invariants
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: New highlight overdraws arrow
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Image binding rule changed
* Trigger Rebuild
* fix:Highlight flicker
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Fully nested shapes
* fix: Tune nested shape binding
* fix: Size-based orbit jump-in
* fix: Binding highlight stroke on sharp bindables
* fix: Nested shape binding
* fix: history
* fix:More precise element nesting check
* feat:Add tolerance to shape nesting detection
* fix: Reverse
* fix:Change center binding to circular
* ignore invisible elements when binding
* feat: Center point with more precise highlight outlines
* fix:Arrow tool hover stuck highlight
* fix:More stroke width for highlight
* POC: highlight center on hover
* tweak binding highlight width
* render highlight on the outside
* fix: Locked elbow arrow creation
* update hints
* reduce timeout
* handle overlap when both elements the same size
* tweak highlight stroke width some more
* fix:Add intersection padding
* fix: New arrow start orbit when nested binds on the end
* fix: Update history snapshot
* feat: Allow inside binding for new arrows in nested cases
* chore: Logic for measurement
* fix: Locked tool + arrow
* feat: Remove center binding
* fix: Jump arrow inside it gets visially too short
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore:Basic interactive canvas animation re-render trigger for highlights
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat:Highlight animations
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix:Refactored and fixed highlight animation
* fix:Poisoned arrow
* fix Arrow edit mode selection
* fix:Tool lock binding behavior restored
* fix:Overlap inside binding
* fix:Animated binding highlight
* alt anims + increase timeout to 700
* tweak animation some more + remove countdown
* fix: False bind timeout indicator
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: better file normalization (#10024)
* feat: better file normalization
* fix lint
* fix png detection
* optimize
* fix type
* fix: increase rejection delay for opening files with legacy api (#8961)
* Increased input change interval to 1000 ms to fix IOS 18 file opening issue
* increase more
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat: library search (#9903)
* feat(utils): add support for search input type in isWritableElement
* feat(i18n): add search text
* feat(cmdp+lib): add search functionality for command pallete and lib menu items
* chore: fix formats, and whitespaces
* fix: opt to optimal code changes
* chore: fix for linting
* focus input on mount
* tweak placeholder
* design and UX changes
* tweak item hover/active/seletected states
* unrelated: move publish button above delete/clear to keep it more stable
* esc to clear search input / close sidebar
* refactor command pallete library stuff
* make library commands bigger
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Allow already inside bound arrows to continue inside binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: No angle lock over bindable elements
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Center binding on SHIFT key
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Fix ghost start binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* FEAT: No binding to frame cutout
* feat: Bind to frame when frame-bound object hidden part is approached
* fix: revert preferred selection to box once you switch to `full` UI (#10160)
* fix: mobile UI and other fixes (#10177)
* remove legacy openMenu=shape state and unused actions
* close menus/popups in applicable cases when opening a different one
* split ui z-indexes to account prefer different overlap
* make top canvas area clickable on mobile
* make mobile main menu closable by clicking outside and reduce width
* offset picker popups from viewport border on mobile
* reduce items gap in mobile main menu
* show top picks for canvas bg colors in all ui modes
* fix menu separator visibility on mobile
* fix command palette items not being filtered
* fix: Increase transform handle offset (#10180)
* fix: Increase transform handle offset
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Temporarily disable transform handles for linear elements on mobile and tablets
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Linear hidden resize
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* disable mobielOrTablet linear element bbox completely
* fix: Test
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: context menu getting covered (#10199)
* do not show z-index actions on mobile or tablet
* fix: context menu getting covered
* fix lint
* fix style popup getting covered
* put contextmenu z-index above sidebar
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat: More prominent keyboard shortcuts in hints (#10057)
* Initial
* Memoize
* Styling
* Use double angle brackets for keyboard shortcuts
* Use rem in gap
* Use an existing function for substituting tags in a string
* Revert styling
* Avoid unique key warnings
* Styling
* getTransChildren -> nodesFromTextWithTags
* Use height and padding instead of padding only
* Initial new idea
* WIP shortcut substitutions
* Use simple regex for parsing shortcuts
* Use single shortcut for combos
* Use kbd instead of span
* shortcutFromKeyString -> getTaggedShortcutKey
* Bug fix
* FlowChart -> Flowchart
* memo is useless here
* Trigger CI
* Translate in getShortcutKey
* More normalized shortcuts
* improve shortcut normalization and replacement & support multi-key tagged shortcuts
* fix regex
* tweak css
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: small tweaks to shortcut hints (#10214)
* fix: Test
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Bind mode
* feat: Support special key shortcut highlight
* fix: Lint
* fix: Remove non-needed function
* fix: Skip frame cutout for hover, but keep shape for binding
* fix: Lint
* fix: Restore removal of deleted elements on restore
* fix: Inside-inside during drag
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Arrow vanishes when orbit binding to the same element
* feat: Feature flag support
* Simplified binding
* fix: Diamond corner binding
* feat: Binding highlight band re-added
* feat: Settings menu
* fix: Same shape binding
* fix: set radix PropertiesPopover collision boundary (#10221)
* Set collision boundary
* Calculate collisionPadding dynamically based on container
* Add appState offsetTop and offsetLeft to padding calculation.
Refactor collisionPadding calculation to use app state offsets.
* Update PropertiesPopover.tsx
* popover positioning relative to container
* fix: prevent wrap text in a container to only text that are not bound to a container (#10250)
* fix: only enable wrap text in a container when at least one text element selected is unbound
* Trigger Rebuild
---------
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Uncap the nodejs version requirement (#10238)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* refactor: single source of truths with editor interface (#10178)
* refactor device to editor interface and derive styles panel
* allow host app to control form factor and ui mode
* add editor interface event listener
* put new props inside UIOptions
* refactor: move related apis into one file
* expose getFormFactor
* privatize the setting of desktop mode and fix snapshots
* refactor and fix test
* remove unimplemented code
* export getFormFactor()
* replace `getFormFactor` with `getEditorInterface`
* remove dead & useless
* comment
* fix ts
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* chore: Update translations from Crowdin (#7429)
* New translations en.json (Punjabi)
* New translations en.json (Polish)
* New translations en.json (Russian)
* New translations en.json (Turkish)
* New translations en.json (Ukrainian)
* New translations en.json (Chinese Traditional)
* New translations en.json (Vietnamese)
* New translations en.json (Galician)
* New translations en.json (Portuguese, Brazilian)
* New translations en.json (Persian)
* New translations en.json (Khmer)
* New translations en.json (Tamil)
* New translations en.json (Bengali)
* New translations en.json (Marathi)
* New translations en.json (Thai)
* New translations en.json (Norwegian Nynorsk)
* New translations en.json (Kazakh)
* New translations en.json (Latvian)
* New translations en.json (Azerbaijani)
* New translations en.json (Hindi)
* New translations en.json (Burmese)
* New translations en.json (Chinese Traditional, Hong Kong)
* New translations en.json (Sinhala)
* New translations en.json (Uzbek)
* New translations en.json (Norwegian Bokmal)
* New translations en.json (Occitan)
* New translations en.json (German, Switzerland)
* New translations en.json (Bengali, India)
* New translations en.json (Kabyle)
* New translations en.json (Karakalpak)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Marathi)
* New translations en.json (Hindi)
* New translations en.json (German)
* New translations en.json (Chinese Simplified)
* New translations en.json (Polish)
* New translations en.json (Romanian)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hebrew)
* New translations en.json (Hebrew)
* New translations en.json (Slovak)
* New translations en.json (Slovak)
* New translations en.json (Hungarian)
* New translations en.json (Hungarian)
* New translations en.json (Slovak)
* New translations en.json (Hebrew)
* New translations en.json (Hungarian)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Romanian)
* New translations en.json (French)
* New translations en.json (Spanish)
* New translations en.json (Arabic)
* New translations en.json (Bulgarian)
* New translations en.json (Catalan)
* New translations en.json (Czech)
* New translations en.json (Danish)
* New translations en.json (German)
* New translations en.json (Greek)
* New translations en.json (Basque)
* New translations en.json (Finnish)
* New translations en.json (Italian)
* New translations en.json (Japanese)
* New translations en.json (Kurdish)
* New translations en.json (Lithuanian)
* New translations en.json (Dutch)
* New translations en.json (Punjabi)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Slovenian)
* New translations en.json (Swedish)
* New translations en.json (Turkish)
* New translations en.json (Ukrainian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Vietnamese)
* New translations en.json (Galician)
* New translations en.json (Portuguese, Brazilian)
* New translations en.json (Indonesian)
* New translations en.json (Persian)
* New translations en.json (Khmer)
* New translations en.json (Tamil)
* New translations en.json (Bengali)
* New translations en.json (Marathi)
* New translations en.json (Thai)
* New translations en.json (Norwegian Nynorsk)
* New translations en.json (Kazakh)
* New translations en.json (Latvian)
* New translations en.json (Azerbaijani)
* New translations en.json (Hindi)
* New translations en.json (Burmese)
* New translations en.json (Chinese Traditional, Hong Kong)
* New translations en.json (Sinhala)
* New translations en.json (Uzbek)
* New translations en.json (Norwegian Bokmal)
* New translations en.json (Occitan)
* New translations en.json (German, Switzerland)
* New translations en.json (Bengali, India)
* New translations en.json (Kabyle)
* New translations en.json (Karakalpak)
* New translations en.json (Romanian)
* New translations en.json (German)
* New translations en.json (Slovenian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Spanish)
* New translations en.json (Russian)
* New translations en.json (Chinese Traditional)
* New translations en.json (Turkish)
* New translations en.json (Slovak)
* New translations en.json (Slovak)
* New translations en.json (Hebrew)
* New translations en.json (Hungarian)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Romanian)
* New translations en.json (French)
* New translations en.json (Spanish)
* New translations en.json (Arabic)
* New translations en.json (Bulgarian)
* New translations en.json (Catalan)
* New translations en.json (Czech)
* New translations en.json (Danish)
* New translations en.json (German)
* New translations en.json (Greek)
* New translations en.json (Basque)
* New translations en.json (Finnish)
* New translations en.json (Italian)
* New translations en.json (Japanese)
* New translations en.json (Kurdish)
* New translations en.json (Lithuanian)
* New translations en.json (Dutch)
* New translations en.json (Punjabi)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Slovenian)
* New translations en.json (Swedish)
* New translations en.json (Turkish)
* New translations en.json (Ukrainian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Vietnamese)
* New translations en.json (Galician)
* New translations en.json (Portuguese, Brazilian)
* New translations en.json (Indonesian)
* New translations en.json (Persian)
* New translations en.json (Khmer)
* New translations en.json (Tamil)
* New translations en.json (Bengali)
* New translations en.json (Marathi)
* New translations en.json (Thai)
* New translations en.json (Norwegian Nynorsk)
* New translations en.json (Kazakh)
* New translations en.json (Latvian)
* New translations en.json (Azerbaijani)
* New translations en.json (Hindi)
* New translations en.json (Burmese)
* New translations en.json (Chinese Traditional, Hong Kong)
* New translations en.json (Sinhala)
* New translations en.json (Uzbek)
* New translations en.json (Norwegian Bokmal)
* New translations en.json (Occitan)
* New translations en.json (German, Switzerland)
* New translations en.json (Bengali, India)
* New translations en.json (Kabyle)
* New translations en.json (Karakalpak)
* New translations en.json (German)
* New translations en.json (Russian)
* New translations en.json (Romanian)
* New translations en.json (Spanish)
* New translations en.json (Chinese Simplified)
* New translations en.json (Marathi)
* New translations en.json (Hindi)
* New translations en.json (Slovak)
* New translations en.json (German)
* New translations en.json (Portuguese)
* New translations en.json (Romanian)
* New translations en.json (French)
* New translations en.json (Spanish)
* New translations en.json (Arabic)
* New translations en.json (Bulgarian)
* New translations en.json (Catalan)
* New translations en.json (Czech)
* New translations en.json (Danish)
* New translations en.json (German)
* New translations en.json (Greek)
* New translations en.json (Basque)
* New translations en.json (Finnish)
* New translations en.json (Hebrew)
* New translations en.json (Hungarian)
* New translations en.json (Italian)
* New translations en.json (Japanese)
* New translations en.json (Korean)
* New translations en.json (Kurdish)
* New translations en.json (Lithuanian)
* New translations en.json (Dutch)
* New translations en.json (Punjabi)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Slovak)
* New translations en.json (Slovenian)
* New translations en.json (Swedish)
* New translations en.json (Turkish)
* New translations en.json (Ukrainian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Traditional)
* New translations en.json (Vietnamese)
* New translations en.json (Galician)
* New translations en.json (Portuguese, Brazilian)
* New translations en.json (Indonesian)
* New translations en.json (Persian)
* New translations en.json (Khmer)
* New translations en.json (Tamil)
* New translations en.json (Bengali)
* New translations en.json (Marathi)
* New translations en.json (Thai)
* New translations en.json (Norwegian Nynorsk)
* New translations en.json (Kazakh)
* New translations en.json (Latvian)
* New translations en.json (Azerbaijani)
* New translations en.json (Hindi)
* New translations en.json (Burmese)
* New translations en.json (Chinese Traditional, Hong Kong)
* New translations en.json (Sinhala)
* New translations en.json (Uzbek)
* New translations en.json (Norwegian Bokmal)
* New translations en.json (Occitan)
* New translations en.json (German, Switzerland)
* New translations en.json (Bengali, India)
* New translations en.json (Kabyle)
* New translations en.json (Karakalpak)
* Auto commit: Calculate translation coverage
* New translations en.json (Chinese Simplified)
* Auto commit: Calculate translation coverage
* New translations en.json (Romanian)
* Auto commit: Calculate translation coverage
* New translations en.json (Romanian)
* Auto commit: Calculate translation coverage
* New translations en.json (French)
* Auto commit: Calculate translation coverage
* New translations en.json (Polish)
* Auto commit: Calculate translation coverage
* New translations en.json (Polish)
* Auto commit: Calculate translation coverage
* New translations en.json (Turkish)
* Auto commit: Calculate translation coverage
* New translations en.json (Turkish)
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: mobile view ui issues (#10284)
* hide zen mode when formFactor = phone
* tool bar fixes: icon and width
* view mode
* fix lint
* add exit-view-mode button
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* chore: Update snaps
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Blue highlight
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Diagonal binding point
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove settings
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Jump other binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Hovered arrow mode highlight
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* feat: Alt does not snap
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Check debug
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt precise positioning
* fix: Jump out to orbit for new arrows when dragged outside
* fix: New arrow preserved projection
* chore: Remove debug
* chore: Introduce different debug color for orbit and other binding modes
* fix: Restore arrow start point when self binding
* fix: Turn of start jump-out
* fix: Tests
* fix: Select the first possible altBindPoint
* fix: Random projection
* fix: Use last point for existing arrows
* fix: Preserve alternate orbit focus point during drag
* fix: Lint
* fix: Update tests
* fix: Elbow arrow direction at binding
* binding gap and distance and binding highlight tweaks
* chore: Naming refactors
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt-duplication copied elements placement (#10152)
* feat: Animation support (#10042)
* fix: banner url (#10315)
* feat: Animation support (#10042)
* fix: Merge discrepancy
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* chore: Remove non-needed code
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Trigger build
* chore: Remove hint for V1
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* shorten focus point diagonal helpers to fix corner binding cases
* fix: Tests
* fix: Multi-point arrow closeness fallback
* fix: Finalize multipoint arrow on binding area click
* fix: Finalize arrow now truly finalzes
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Point click arrow creation jumping to orbit
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Alt+drag movement block
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Trigger build
* feat: hide point highlight when dragging
* feat: hide bbox when dragging points
* revert binding gap increase for elbow arrows
* reset selectionLinearElement on tool change
* chore: Remove debug
* feat: Better restore for bindings
* use elementsMap instead of array when passing to restoreElement
* fix: Arrow angle reset
* fix: Arrow angle
* Arrow angle support
* fix trashing cached canvases in `LinearElementEditor.getElementAbsoluteCoords`
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* refactor device to editor interface and derive styles panel
* allow host app to control form factor and ui mode
* add editor interface event listener
* put new props inside UIOptions
* refactor: move related apis into one file
* expose getFormFactor
* privatize the setting of desktop mode and fix snapshots
* refactor and fix test
* remove unimplemented code
* export getFormFactor()
* replace `getFormFactor` with `getEditorInterface`
* remove dead & useless
* comment
* fix ts
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: only enable wrap text in a container when at least one text element selected is unbound
* Trigger Rebuild
---------
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
* Set collision boundary
* Calculate collisionPadding dynamically based on container
* Add appState offsetTop and offsetLeft to padding calculation.
Refactor collisionPadding calculation to use app state offsets.
* Update PropertiesPopover.tsx
* popover positioning relative to container
* Initial
* Memoize
* Styling
* Use double angle brackets for keyboard shortcuts
* Use rem in gap
* Use an existing function for substituting tags in a string
* Revert styling
* Avoid unique key warnings
* Styling
* getTransChildren -> nodesFromTextWithTags
* Use height and padding instead of padding only
* Initial new idea
* WIP shortcut substitutions
* Use simple regex for parsing shortcuts
* Use single shortcut for combos
* Use kbd instead of span
* shortcutFromKeyString -> getTaggedShortcutKey
* Bug fix
* FlowChart -> Flowchart
* memo is useless here
* Trigger CI
* Translate in getShortcutKey
* More normalized shortcuts
* improve shortcut normalization and replacement & support multi-key tagged shortcuts
* fix regex
* tweak css
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* do not show z-index actions on mobile or tablet
* fix: context menu getting covered
* fix lint
* fix style popup getting covered
* put contextmenu z-index above sidebar
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: Increase transform handle offset
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Temporarily disable transform handles for linear elements on mobile and tablets
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Linear hidden resize
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* disable mobielOrTablet linear element bbox completely
* fix: Test
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* fix: Lint
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* remove legacy openMenu=shape state and unused actions
* close menus/popups in applicable cases when opening a different one
* split ui z-indexes to account prefer different overlap
* make top canvas area clickable on mobile
* make mobile main menu closable by clicking outside and reduce width
* offset picker popups from viewport border on mobile
* reduce items gap in mobile main menu
* show top picks for canvas bg colors in all ui modes
* fix menu separator visibility on mobile
* fix command palette items not being filtered
* compact bottom toolbar
* put menu trigger to top left
* add popup to switch between grouped tool types
* add a dedicated mobile toolbar
* update position for mobile
* fix active tool type
* add mobile mode as well
* mobile actions
* remove refactored popups
* excali logo mobile
* include mobile
* update mobile menu layout
* move selection and deletion back to right
* do not fill eraser
* fix styling
* fix active styling
* bigger buttons, smaller gaps
* fix other tools not opened
* fix: Style panel persistence and restore
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* move hidden action btns to extra popover
* fix dropdown overlapping with welcome screen
* replace custom popup with popover
* improve button styles
* swapping redo and delete
* always show undo & redo and improve styling
* change background
* toolbar styles
* no any
* persist perferred selection tool and align tablet as well
* add a renderTopLeftUI to props
* tweak border and bg
* show combined properties only when using suitable tools
* fix preferred tool
* new stroke icon
* hide color picker hot keys
* init preferred tool based on device
* fix main menu sizing
* fix welcome screen offset
* put text before image
* disable call highlight on buttons
* fix renderTopLeftUI
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: display error message when local storage quota is exceeded
* add danger alert instead of toast
* tweak text
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: support bidirectional shift+click selection in library items
- Enable bottom-up multi-selection (previously only top-down worked)
- Use Math.min/max to handle selection range in both directions
- Maintains existing behavior for preserving non-contiguous selections
- Fixes issue where shift+clicking items above last selected item failed
* improve deselection behavior
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat(utils): add support for search input type in isWritableElement
* feat(i18n): add search text
* feat(cmdp+lib): add search functionality for command pallete and lib menu items
* chore: fix formats, and whitespaces
* fix: opt to optimal code changes
* chore: fix for linting
* focus input on mount
* tweak placeholder
* design and UX changes
* tweak item hover/active/seletected states
* unrelated: move publish button above delete/clear to keep it more stable
* esc to clear search input / close sidebar
* refactor command pallete library stuff
* make library commands bigger
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: fixed a bug where a MIME-mismatch in an image would cause an error to update cache
* fix: fixed a bug where a MIME-mismatch in an image would cause an error to update cache
* normalize inside insertImages()
---------
Co-authored-by: Mårten Mossberg <marmo607@student.liu.se>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* Remove local elements when there is room data
* Update excalidraw-app/collab/Collab.tsx
---------
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
* Fix for race condition when adding many library items
* Remove unused import
* Replace any with LibraryItem type
* Fix comments on pr
* Fix build errors
* Fix hoisted variable
* new mime type
* duplicate before passing down to be sure
* lint
* fix tests
* Remove unused import
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat: allow the hiding of top picks
* feat: allow the hiding of default fonts
* refactor: rename to compactMode
* feat: introduce layout (incomplete)
* tweak icons
* do not show border
* lint
* add isTouchMobile to device
* add isTouchMobile to device
* refactor to use showCompactSidebar instead
* hide library label in compact
* fix icon color in dark theme
* fix library and share btns getting hidden in smaller tablet widths
* update tests
* use a smaller gap between shapes
* proper fix of range
* quicker switching between different popovers
* to not show properties panel at all when editing text
* fix switching between different popovers for texts
* fix popover not closable and font search auto focus
* change properties for a new or editing text
* change icon for more style settings
* use bolt icon for extra actions
* fix breakpoints
* use rem for icon sizes
* fix tests
* improve switching between triggers (incomplete)
* improve trigger switching (complete)
* clean up code
* put compact into app state
* fix button size
* remove redundant PanelComponentProps["compactMode"]
* move fontSize UI on top
* mobile detection (breakpoints incomplete)
* tweak compact mode detection
* rename appState prop & values
* update snapshots
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: restore from invalid fixedSegments & type-safer point updates
* fix: Type updates and throw for invalid point states
---------
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
* feat: drag, resize, and rotate after selecting in lasso
* alternative ux: drag with lasso right away
* fix: lasso dragging should snap too
* fix: alt+cmd getting stuck
* test: snapshots
* alternatvie: keep lasso drag to only mobile
* alternative: drag after selection on PCs
* improve mobile dection
* add mobile lasso icon
* add default selection tool
* render according to default selection tool
* return to default selection tool after deletion
* reset to default tool after clearing out the canvas
* return to default tool after eraser toggle
* if default lasso, close lasso toggle
* finalize to default selection tool
* toggle between laser and default selection
* return to default selection tool after creation
* double click to add text when using default selection tool
* set to default selection tool after unlocking tool
* paste to center on touch screen
* switch to default selection tool after pasting
* lint
* fix tests
* show welcome screen when using default selection tool
* fix tests
* fix snapshots
* fix context menu not opening
* prevent potential displacement issue
* prevent element jumping during lasso selection
* fix dragging on mobile
* use same selection icon
* fix alt+cmd lasso getting cut off
* fix: shortcut handling
* lint
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: awkward point adding and removing on touch device
* feat: move finalize to next to last point
* feat: on touch screen, click would create a default line/arrow
* fix: make default adaptive to zoom
* fix: increase padding to avoid cutoffs
* refactor: simplify
* fix: only use bigger padding when needed
* center arrow horizontally on pointer
* increase min drag distance before we start 2-point-arrow-drag-creating
* do not render 0-width arrow while creating
* dead code
* fix tests
* fix: remove redundant code
* do not enter line editor on creation
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: set cursor to auto when not hovering a point on linear element #9628
* Simplify hover test for cursor
* Add back comment
* Fix test for hit testing
---------
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
* fix : double click on line enables line editor
* fix : prevent double-click to edit/create text
when inside line editor
* refactor: use lineCheck instead of arrowCheck in
doubleClick handler to align with updated logic
* fix: replace negative arrowCheck with lineCheck in
dbl click handler and fix double-click bind text
test in linearElementEditor tests
* clean up test
* simplify check
* add tests
* prevent text editing on dblclick when inside arrow editor
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* Loop Lock/Unlock
* fixed condition. 4 line points are required for the action to be available
* extracted updateLoopLock to improve readability. Removed unnecessary SVG attributes
* lint + added loopLock to restore.ts
* added loopLock to newElement, updated test snapshots
* lint
* dislocate enpoint when breaking the loop.
* change icon & turn into a state style button
* POC: auto-transform to polygon on bg set
* keep polygon icon constant
* do not split points on de-polygonizing & highlight overlapping points
* rewrite color picker to support no (mixed) colors & fix focus handling
* refactor
* tweak point rendering inside line editor
* do not disable polygon when creating new points via alt
* auto-enable polygon when aligning start/end points
* TBD: remove bg color when disabling polygon
* TBD: only show polygon button for enabled polygons
* fix polygon behavior when adding/removing/moving points within line editor
* convert to polygon when creating line
* labels tweak
* add to command palette
* loopLock -> polygon
* restore `polygon` state on type conversions
* update snapshots
* naming
* break polygon on restore/finalize if invalid & prevent creation
* snapshots
* fix: merge issue and forgotten debug
* snaps
* do not merge points for 3-point lines
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* First iter
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Restore binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* More actionFinalize
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Additional fixes
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* New elbow arrow is removed if too small
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Remove very small arrows
* Still allow loops
* Restore tests
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Update history snapshot
* More history snapshot updates
* keep invisible 2-point lines/freedraw elements
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* change lock label
* feat: add unlock logic for single units on pointer up
* feat: add unlock popup
* fix: linting errors
* style: padding tweaks
* style: remove redundant line
* feat: lock multiple units together
* style: tweak color & position
* feat: add highlight for locked elements
* feat: select groups correctly after unlocking
* test: update snapshots
* fix: lasso from selecting locked elements
* fix: should prevent selecting unlocked elements and setting locked id at the same time
* fix: reset hit locked id immediately when appropriate
* feat: capture locked units in delta
* test: update locking test
* feat: show lock highlight when locking (including undo/redo)
* feat: make locked highlighting consistent
* feat: show correct cursor type when moving over locked elements
* fix history
* remove `lockedUnits.singleUnits`
* tweak button
* do not render UnlockPopup if not locked element selected
* tweak actions
* refactor: simplify type
* refactor: rename type
* refactor: simplify hit element setting & checking
* fix: prefer locked over link
* rename to `activeLockedId`
* refactor: getElementAtPosition takes an optional hitelments array
* fix: avoid setting active locked id after resizing
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: alt + ctrl lasso selected elements not always kept
* Update packages/excalidraw/components/App.tsx
---------
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
* Do not set link background color, dynamically scale down link icon size with zoom.
* removed unnecessary change
* use canvas bg color & reduce size and stroke width
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* Update embeddable.ts
* no need for same origin
* The form does not load without allow same origin
* automatically add embed=true to link if not present
* fix link check
* fix frame name clipping on zooming
* include assistant font
* default frame name
* extend search to frame names
* add a simple test
* collpase search match items
* id check out of loop
* fix frame name check
* include focusedId for small perf improvement
* optionally show and hide collapse icon
* update section title
* fix tests
* rename `serverSide` -> `private`
* revert: do not reset zoom on zoom change
* feat: do not close menu on repeated ctrl+f
* remove collapsible
* tweak results CSS
* remove redundant check
* set `appState.searchMatches` to null if empty
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* feat: switch between basic shapes
* add tab for testing
* style tweaks
* only show hint when a new node is created
* fix panel state
* refactor
* combine captures into one
* keep original font size
* switch multi
* switch different types altogether
* use tab only
* fix font size atom
* do not switch from active tool change
* prefer generic when mixed
* provide an optional direction when shape switching
* adjust panel bg & shadow
* redraw to correctly position text
* remove redundant code
* only tab to switch if focusing on app container
* limit which linear elements can be switched
* add shape switch to command palette
* remove hint
* cache initial panel position
* bend line to elbow if needed
* remove debug logic
* clean switch of arrows using app state
* safe conversion between line, sharp, curved, and elbow
* cache linear when panel shows up
* type safe element conversion
* rename type
* respect initial type when switching between linears
* fix elbow segment indexing
* use latest linear
* merge converted elbow points if too close
* focus on panel after click
* set roudness to null to fix drag points offset for elbows
* remove Mutable
* add arrowBoundToElement check
* make it dependent on one signle state
* unmount when not showing
* simpler types, tidy up code
* can change linear when it's linear + non-generic
* fix popup component lifecycle
* move constant to CLASSES
* DRY out type detection
* file & variable renaming
* refactor
* throw in not-prod instead
* simplify
* semi-fix bindings on `generic` type conversion
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* Fix laser pointer trail disappearing on pointerup (#9413)
Previously, the laser pointer trail would disappear as soon as the pointerup event was triggered. This fix delays the trail removal to ensure it persists for a smoother visual experience.
Fixes#9413.
* Remove extra blank lines
Minor formatting cleanup. No functional changes.
* Expose renderScrollbars to AppState
* fix: scrollbar rendering should use al renderable elements
* remove `appState.renderScrollbars`
* clean unused
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix: keep orig elem in place on alt-duplication
* clarify comment
* fix: incorrect selection on duplicating labeled containers
* fix: duplicating within group outside frame should remove from group
* Add DOCTYPE and XML preamble in exported SVG documents
* Update packages/excalidraw/data/index.ts
---------
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
* fix: deselected hit element being duplicated + incorrect re-seeding
* snapshots
* Fix alt-drag binding
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
* Add alt-drag bound arrow test
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
---------
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: Mark Tolmacs <mark@lazycat.hu>
* lasso without 'real' shape detection
* select a single linear el
* improve ux
* feed segments to worker
* simplify path threshold adaptive to zoom
* add a tiny threshold for checks
* refactor code
* lasso tests
* fix: ts
* do not capture lasso tool
* try worker-loader in next config
* update config
* refactor
* lint
* feat: show active tool when using "more tools"
* keep lasso if selected from toolbar
* fix incorrect checks for resetting to selection
* shift for additive selection
* bound text related fixes
* lint
* keep alt toggled lasso selection if shift pressed
* fix regression
* fix 'dead' lassos
* lint
* use workerpool and polyfill
* fix worker bundled with window related code
* refactor
* add file extension for worker constructor error
* another attempt at constructor error
* attempt at build issue
* attempt with dynamic import
* test not importing from math
* narrow down imports
* Reusing existing workers infrastructure (fallback to the main thread, type-safety)
* Points on curve inside the shared chunk
* Give up on experimental code splitting
* Remove potentially unnecessary optimisation
* Removing workers as the complexit is much worse, while perf. does not seem to be much better
* fix selecting text containers and containing frames together
* render fill directly from animated trail
* do not re-render static when setting selected element ids in lasso
* remove unnecessary property
* tweak trail animation
* slice points to remove notch
* always start alt-lasso from initial point
* revert build & worker changes (unused)
* remove `lasso` from `hasStrokeColor`
* label change
* remove unused props
* remove unsafe optimization
* snaps
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
Co-authored-by: Marcel Mraz <marcel@excalidraw.com>
* chore: bump @radix-ui/react-tabs version to 1.1.3
bumped the version to latest stable that includes
react ^19 as peerDepenecy.
This fixes peerDependency issues, as reported in #9253
* redeploy
---------
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
<img alt="Chat on Discord" src="https://img.shields.io/discord/723672430744174682?color=738ad6&label=Chat%20on%20Discord&logo=discord&logoColor=ffffff&widge=false"/>
</a>
<img alt="Chat on Discord" src="https://img.shields.io/discord/723672430744174682?color=738ad6&label=Chat%20on%20Discord&logo=discord&logoColor=ffffff&widge=false"/></a>
<img alt="Follow Excalidraw on Twitter" src="https://img.shields.io/twitter/follow/excalidraw.svg?label=follow+@excalidraw&style=social&logo=twitter"/>
</a>
<img alt="Follow Excalidraw on Twitter" src="https://img.shields.io/twitter/follow/excalidraw.svg?label=follow+@excalidraw&style=social&logo=twitter"/></a>
</p>
<div align="center">
@@ -63,7 +60,7 @@ The Excalidraw editor (npm package) supports:
- 🏗️ Customizable.
- 📷 Image support.
- 😀 Shape libraries support.
-👅 Localization (i18n) support.
-🌐 Localization (i18n) support.
- 🖼️ Export to PNG, SVG & clipboard.
- 💾 Open format - export drawings as an `.excalidraw` json file.
- ⚒️ Wide range of tools - rectangle, circle, diamond, arrow, line, free-draw, eraser...
@@ -87,13 +84,11 @@ We'll be adding these features as drop-in plugins for the npm package in the fut
**Note:** following instructions are for installing the Excalidraw [npm package](https://www.npmjs.com/package/@excalidraw/excalidraw) when integrating Excalidraw into your own app. To run the repository locally for development, please refer to our [Development Guide](https://docs.excalidraw.com/docs/introduction/development).
Earlier we were using `renderFooter` prop to render custom footer which was removed in [#5970](https://github.com/excalidraw/excalidraw/pull/5970). Now you can pass a `Footer` component instead to render the custom UI for footer.
You will need to import the `Footer` component from the package and wrap your component with the Footer component. The `Footer` should a valid React Node.
You will need to import the `Footer` component from the package and wrap your component with the Footer component. The `Footer` should be a valid React Node.
**Usage**
```jsx live
function App() {
return (
<div style={{ height: "500px"}}>
<div style={{ height: "500px"}}>
<Excalidraw>
<Footer>
<button
@@ -25,21 +25,21 @@ function App() {
}
```
This will only for `Desktop` devices.
This will only work for `Desktop` devices.
For `mobile` you will need to render it inside the [MainMenu](#mainmenu). You can use the [`useDevice`](#useDevice) hook to check the type of device, this will be available only inside the `children` of `Excalidraw` component.
For `mobile` you will need to render it inside the [MainMenu](#mainmenu). You can use the [`useEditorInterface`](#useEditorInterface) hook to check the type of device, this will be available only inside the `children` of `Excalidraw` component.
Open the `Menu` in the below playground and you will see the `custom footer` rendered.
```jsx live noInline
const MobileFooter = ({}) => {
const device = useDevice();
if (device.editor.isMobile) {
const editorInterface = useEditorInterface();
if (editorInterface.formFactor === "phone") {
return (
<Footer>
<button
className="custom-footer"
style={{ marginLeft: '20px', height: '2rem'}}
style={{ marginLeft: "20px", height: "2rem" }}
onClick={() => alert("This is custom footer in mobile menu")}
>
custom footer
@@ -65,4 +65,4 @@ const App = () => (
// Need to render when code is span across multiple components
@@ -65,7 +65,7 @@ You can use this function to update the scene with the sceneData. It accepts the
| `elements` | [`ImportedDataState["elements"]`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/types.ts#L38) | The `elements` to be updated in the scene |
| `appState` | [`ImportedDataState["appState"]`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/types.ts#L39) | The `appState` to be updated in the scene. |
| `collaborators` | <code>Map<string, <a href="https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L37">Collaborator></a></code> | The list of collaborators to be updated in the scene. |
| `commitToStore` | `boolean` | Implies if the change should be captured and commited to the `store`. Commited changes are emmitted and listened to by other components, such as `History` for undo / redo purposes. Defaults to `false`. |
| `captureUpdate` | [`CaptureUpdateAction`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/store.ts#L40) | Controls which updates should be captured by the `Store`. Captured updates are emmitted and listened to by other components, such as `History` for undo / redo purposes. |
```jsx live
function App() {
@@ -105,6 +105,7 @@ function App() {
appState: {
viewBackgroundColor: "#edf2ff",
},
captureUpdate: CaptureUpdateAction.IMMEDIATELY,
};
excalidrawAPI.updateScene(sceneData);
};
@@ -121,6 +122,18 @@ function App() {
}
```
#### captureUpdate
You can use the `captureUpdate` to influence undo / redo behaviour.
> **NOTE**: Some updates are not observed by the store / history - i.e. updates to `collaborators` object or parts of `AppState` which are not observed (not `ObservedAppState`). Such updates will never make it to the undo / redo stacks, regardless of the passed `captureUpdate` value.
| | `captureUpdate` value | Notes |
| --- | --- | --- |
| _Immediately undoable_ | `CaptureUpdateAction.IMMEDIATELY` | Use for updates which should be captured. Should be used for most of the local updates. These updates will _immediately_ make it to the local undo / redo stacks. |
| _Eventually undoable_ | `CaptureUpdateAction.EVENTUALLY` | Use for updates which should not be captured immediately - likely exceptions which are part of some async multi-step process. Otherwise, all such updates would end up being captured with the next `CaptureUpdateAction.IMMEDIATELY` - triggered either by the next `updateScene` or internally by the editor. These updates will _eventually_ make it to the local undo / redo stacks. |
| _Never undoable_ | `CaptureUpdateAction.NEVER` | Use for updates which should never be recorded, such as remote updates or scene initialization. These updates will _never_ make it to the local undo / redo stacks. |
### updateLibrary
<pre>
@@ -349,22 +362,15 @@ This API has the below signature. It sets the `tool` passed in param as the acti
| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool. When setting `image` as active tool, the insertion onto canvas when using image tool is disabled by default, so you can enable it by setting `insertOnCanvasDirectly` to `true` |
| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool |
| `locked` | `boolean` | `false` | Indicates whether the the active tool should be locked. It behaves the same way when using the `lock` tool in the editor interface |
This helps to load Excalidraw with `initialData`. It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
| [`initialData`](/docs/@excalidraw/excalidraw/api/props/initialdata) | `object` | `null` | <code>Promise<object | null></code> | `null` | The initial data with which app loads. |
| [`excalidrawAPI`](/docs/@excalidraw/excalidraw/api/props/excalidraw-api) | `function` | \_ | Callback triggered with the excalidraw api once rendered |
| [`isCollaborating`](#iscollaborating) | `boolean` | \_ | This indicates if the app is in `collaboration` mode |
@@ -13,7 +13,7 @@ All `props` are _optional_.
| [`onScrollChange`](#onscrollchange) | `function` | \_ | This prop if passed gets triggered when scrolling the canvas. |
| [`onPaste`](#onpaste) | `function` | \_ | Callback to be triggered if passed when something is pasted into the scene |
| [`onLibraryChange`](#onlibrarychange) | `function` | \_ | The callback if supplied is triggered when the library is updated and receives the library items. |
| [`generateLinkForSelection`](#generateLinkForSelection) | `function` | \_ | Allows you to override `url` generation when linking to Excalidraw elements. |
| [`generateLinkForSelection`](#generatelinkforselection) | `function` | \_ | Allows you to override `url` generation when linking to Excalidraw elements. |
| [`onLinkOpen`](#onlinkopen) | `function` | \_ | The callback if supplied is triggered when any link is opened. |
| [`langCode`](#langcode) | `string` | `en` | Language code string to be used in Excalidraw |
| [`renderTopRightUI`](/docs/@excalidraw/excalidraw/api/props/render-props#rendertoprightui) | `function` | \_ | Render function that renders custom UI in top right corner |
@@ -29,8 +29,9 @@ All `props` are _optional_.
| [`handleKeyboardGlobally`](#handlekeyboardglobally) | `boolean` | `false` | Indicates whether to bind the keyboard events to document. |
| [`autoFocus`](#autofocus) | `boolean` | `false` | Indicates whether to focus the Excalidraw component on page load |
| [`generateIdForFile`](#generateidforfile) | `function` | \_ | Allows you to override `id` generation for files added on canvas |
| [`renderEmbeddable`](/docs/@excalidraw/excalidraw/api/props/render-props#renderEmbeddable) | `function` | \_ | Render function that can override the built-in `<iframe>` |
| [`renderScrollbars`] | `boolean` | | `false` | Indicates whether scrollbars will be shown |
### Storing custom data on Excalidraw elements
@@ -246,7 +247,7 @@ This prop indicates whether to `focus` the Excalidraw component on page load. De
Allows you to override `id` generation for files added on canvas (images). By default, an SHA-1 digest of the file is used.
| `elements` | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114) | | The elements to be exported to canvas. |
| `appState` | [AppState](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/packages/utils.ts#L23) | [Default App State](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/appState.ts#L17) | The app state of the scene. |
| [`getDimensions`](#getdimensions) | `function` | _ | A function which returns the `width`, `height`, and optionally `scale` (defaults to `1`), with which canvas is to be exported. |
| `maxWidthOrHeight` | `number` | _ | The maximum `width` or `height` of the exported image. If provided, `getDimensions` is ignored. |
| `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L59) | _ | The files added to the scene. |
| [`getDimensions`](#getdimensions) | `function` | \_ | A function which returns the `width`, `height`, and optionally `scale` (defaults to `1`), with which canvas is to be exported. |
| `maxWidthOrHeight` | `number` | \_ | The maximum `width` or `height` of the exported image. If provided, `getDimensions` is ignored. |
| `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L59) | \_ | The files added to the scene. |
| `exportPadding` | `number` | `10` | The `padding` to be added on canvas. |
#### getDimensions
```tsx
(width: number, height: number) => {
(width: number, height: number) => {
width: number,
height: number,
scale?: number
height: number,
scale?: number
}
```
A function which returns the `width`, `height`, and optionally `scale` (defaults to `1`), with which canvas is to be exported.
A function which returns the `width`, `height`, and optionally `scale` (defaults to `1`), with which canvas is to be exported.
| `quality` | `number` | `0.92` | A value between `0` and `1` indicating the [image quality](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#parameters). Applies only to `image/jpeg`/`image/webp` MIME types. |
| `exportPadding` | `number` | `10` | The padding to be added on canvas. |
@@ -132,26 +141,34 @@ Returns a promise which resolves with a [blob](https://developer.mozilla.org/en-
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114) | | The elements to exported as `svg `|
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114) | | The elements to exported as `svg `|
| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L95) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/appState.ts#L11) | The `appState` of the scene |
| exportPadding | number | 10 | The `padding` to be added on canvas |
| files | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L64) | undefined | The `files` added to the scene. |
@@ -176,7 +193,7 @@ exportToClipboard(<br/>
| `opts` | | | This param is same as the params passed to `exportToCanvas`. You can refer to [`exportToCanvas`](#exporttocanvas). |
| `mimeType` | `string` | `image/png` | Indicates the image format, this will be used when exporting as `png`. |
| `quality` | `number` | `0.92` | A value between `0` and `1` indicating the [image quality](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#parameters). Applies only to `image/jpeg` / `image/webp` MIME types. This will be used when exporting as `png`. |
| `type` | 'png' | 'svg' | 'json' | _ | This determines the format to which the scene data should be `exported`. |
| `type` | 'png' | 'svg' | 'json' | \_ | This determines the format to which the scene data should be `exported`. |
@@ -20,8 +20,7 @@ import { restoreAppState } from "@excalidraw/excalidraw";
This function will make sure all the `keys` have appropriate `values` in [appState](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L95) and if any key is missing, it will be set to its `default` value.
When `localAppState` is supplied, it's used in place of values that are missing (`undefined`) in `appState` instead of the defaults.
Use this as a way to not override user's defaults if you persist them.
You can pass `null` / `undefined` if not applicable.
Use this as a way to not override user's defaults if you persist them. You can pass `null` / `undefined` if not applicable.
### restoreElements
@@ -31,15 +30,15 @@ You can pass `null` / `undefined` if not applicable.
| `elements` | <a href="https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114">ImportedDataState["elements"]</a> | The `elements` to be restored |
| [`localElements`](#localelements) | <a href="https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114">ExcalidrawElement[]</a> | null | undefined | When `localElements` are supplied, they are used to ensure that existing restored elements reuse `version` (and increment it), and regenerate `versionNonce`. |
| [`opts`](#opts) | `Object` | The extra optional parameter to configure restored elements
| [`localElements`](#localelements) | <a href="https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/element/types.ts#L114">ExcalidrawElement[]</a> | null | undefined | When `localElements` are supplied, they are used to ensure that existing restored elements reuse `version` (and increment it), and regenerate `versionNonce`. |
| [`opts`](#opts) | `Object` | The extra optional parameter to configure restored elements |
#### localElements
@@ -47,12 +46,14 @@ When `localElements` are supplied, they are used to ensure that existing restore
Use this when you `import` elements which may already be present in the scene to ensure that you do not disregard the newly imported elements if you're using element version to detect the update
#### opts
The extra optional parameter to configure restored elements. It has the following attributes
| Prop | Type | Description|
| --- | --- | ------|
| `refreshDimensions` | `boolean` | Indicates whether we should also `recalculate` text element dimensions. Since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration. |
| `repairBindings` |`boolean` | Indicates whether the `bindings` for the elements should be repaired. This is to make sure there are no containers with non existent bound text element id and no bound text elements with non existent container id. |
| Prop | Type | Description|
| --- | --- | ---|
| `refreshDimensions` | `boolean` | Indicates whether we should also _recalculate_ text element dimensions. Since this is a potentially costly operation, you may want to disable it if you restore elements in tight loops, such as during collaboration. |
| `repairBindings` |`boolean` | Indicates whether the _bindings_ for the elements should be repaired. This is to make sure there are no containers with non existent bound text element id and no bound text elements with non existent container id. |
| `normalizeIndices` | `boolean` | Indicates whether _fractional indices_ for the elements should be normalized. This is to prevent possible issues caused by using stale (too old, too long) indices. |
@@ -13,47 +13,27 @@ To start the example app using the `@excalidraw/excalidraw` package, follow the
1. Install the dependencies
```bash
cd packages/excalidraw && yarn
yarn
```
2. Start the example app
```bash
yarn start
yarn start:example
```
[http://localhost:3001](http://localhost:3001) will open in your default browser.
The example is same as the [codesandbox example](https://ehlz3.csb.app/)
This is the same example as the [CodeSandbox](https://codesandbox.io/p/sandbox/github/excalidraw/excalidraw/tree/master/examples/with-script-in-browser) example.
## Releasing
### Create a test release
You can create a test release by posting the below comment in your pull request:
```bash
@excalibot trigger release
```
Once the version is released `@excalibot` will post a comment with the release version.
### Creating a production release
To release the next stable version follow the below steps:
```bash
yarn prerelease:excalidraw
yarn release --tag=latest --version=0.19.0
```
You need to pass the `version` for which you want to create the release. This will make the changes needed before making the release like updating `package.json`, `changelog` and more.
The next step is to run the `release` script:
```bash
yarn release:excalidraw
```
This will publish the package.
Right now there are two steps to create a production release but once this works fine these scripts will be combined and more automation will be done.
You will need to pass the `latest` tag with `version` for which you want to create the release. This will make the changes needed before publishing the packages into NPM, like updating dependencies of all `@excalidraw/*` packages, generating new entries in `CHANGELOG.md` and more.
@@ -6,23 +6,17 @@ No, Excalidraw package doesn't come with collaboration built in, since the imple
### Turning off Aggressive Anti-Fingerprinting in Brave browser
When *Aggressive Anti-Fingerprinting* is turned on, the `measureText` API breaks which in turn breaks the Text Elements in your drawings. Here is more [info](https://github.com/excalidraw/excalidraw/pull/6336) on the same.
When _Aggressive Anti-Fingerprinting_ is turned on, the `measureText` API breaks which in turn breaks the Text Elements in your drawings. Here is more [info](https://github.com/excalidraw/excalidraw/pull/6336) on the same.
We strongly recommend turning it off. You can follow the steps below on how to do so.
1. Open [excalidraw.com](https://excalidraw.com) in Brave and click on the **Shield** button

1. Open [excalidraw.com](https://excalidraw.com) in Brave and click on the **Shield** button 
<div style={{width:'30rem'}}>
2. Once opened, look for **Aggressively Block Fingerprinting**
2. Once opened, look for **Aggressively Block Fingerprinting** 
3. Switch to **Block Fingerprinting** 
4. Thats all. All text elements should be fixed now 🎉
@@ -30,7 +24,6 @@ We strongly recommend turning it off. You can follow the steps below on how to d
If disabling this setting doesn't fix the display of text elements, please consider opening an [issue](https://github.com/excalidraw/excalidraw/issues/new) on our GitHub, or message us on [Discord](https://discord.gg/UexuTaE).
### ReferenceError: process is not defined
When using `vite` or any build tools, you will have to make sure the `process` is accessible as we are accessing `process.env.IS_PREACT` to decide whether to use `preact` build.
Excalidraw depends on assets such as localization files (if you opt to use them), fonts, and others.
By default, Excalidraw will try to download all the used fonts from the [CDN](https://esm.run/@excalidraw/excalidraw/dist/prod).
By default these assets are loaded from a public CDN [`https://unpkg.com/@excalidraw/excalidraw/dist/`](https://unpkg.com/@excalidraw/excalidraw/dist), so you don't need to do anything on your end.
However, if you want to host these files yourself, you can find them in your `node_modules/@excalidraw/excalidraw/dist` directory, in folders `excalidraw-assets` (for production) and `excalidraw-assets-dev` (for development).
Copy these folders to your static assets directory, and add a `window.EXCALIDRAW_ASSET_PATH` variable in your `index.html` or `index.js` entry file pointing to your public assets path (relative). For example, if you serve your assets from the root of your hostname, you would do:
For self-hosting purposes, you'll have to copy the content of the folder `node_modules/@excalidraw/excalidraw/dist/prod/fonts` to the path where your assets should be served from (i.e. `public/` directory in your project). In that case, you should also set `window.EXCALIDRAW_ASSET_PATH` to the very same path, i.e. `/` in case it's in the root:
```js
window.EXCALIDRAW_ASSET_PATH = "/";
```
or, if you serve your assets from the root of your CDN, you would do:
{`window["EXCALIDRAW_ASSET_PATH"] = location.origin;`} // or use just "/"!
</Script>
```
### Dimensions of Excalidraw
Excalidraw takes _100%_ of `width` and `height` of the containing block so make sure the container in which you render Excalidraw has non zero dimensions.
@@ -12,8 +12,7 @@ import { Excalidraw } from "@excalidraw/excalidraw";
Throughout the documentation we use live, editable Excalidraw examples like the one shown below.
While we aim for the examples to closely reflect what you'd get if you rendered it yourself, we actually initialize it with some props behind the scenes.
For example, we're passing a `theme` prop to it based on the current color theme of the docs you're just reading.
While we aim for the examples to closely reflect what you'd get if you rendered it yourself, we actually initialize it with some props behind the scenes. For example, we're passing a `theme` prop to it based on the current color theme of the docs you're just reading.
:::
@@ -38,6 +37,8 @@ If you want to only import `Excalidraw` component you can do :point_down:
{/* Link should be updated to point to the latest! */} Here is a [source code](https://github.com/excalidraw/excalidraw/tree/master/examples/with-nextjs) for the example with app and pages router. You you can try it out [here](https://excalidraw-package-example-with-nextjs.vercel.app/).
Here is a [source code](https://github.com/excalidraw/excalidraw/tree/master/examples/excalidraw/with-nextjs) for the example with app and pages router. You you can try it out [here](https://excalidraw-package-example-with-nextjs-gh6smrdnq-excalidraw.vercel.app/).
The `types` are available at `@excalidraw/excalidraw/types`, you can view [example for typescript](https://codesandbox.io/s/excalidraw-types-9h2dm)
The `types` are available at `@excalidraw/excalidraw/types`, check [CodeSandbox](https://codesandbox.io/p/sandbox/github/excalidraw/excalidraw/tree/master/examples/with-script-in-browser) example for details.
### Preact
@@ -153,31 +149,14 @@ Since Vite removes env variables by default, you can update the vite config to e
"process.env.IS_PREACT": JSON.stringify("true"),
},
```
:::
## Browser
To use it in a browser directly:
To use it Excalidraw in a browser directly, use the following setup :point_down:
You will need to make sure `react`, `react-dom` is available as shown in the below example. For prod please use the production versions of `react`, `react-dom`.
> **Note**: We rely on import maps to de-duplicate `react`, `react-dom` and `react/jsx-runtime` versions.
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
@@ -191,13 +170,24 @@ import TabItem from "@theme/TabItem";
* [How Parser Works under the hood](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser) - If you are interested in understanding and deep diving into inner workings of the Parser, then make sure to checkout this section.
- [How Parser Works under the hood](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser) - If you are interested in understanding and deep diving into inner workings of the Parser, then make sure to checkout this section.
* [Adding a new diagram type](/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type) - If you want to help us make the mermaid to Excalidraw Parser more powerful, you will find all information in this section to do so.
- [Adding a new diagram type](/docs/@excalidraw/mermaid-to-excalidraw/codebase/new-diagram-type) - If you want to help us make the mermaid to Excalidraw Parser more powerful, you will find all information in this section to do so.
@@ -10,7 +10,7 @@ lets run the playground server in local :point_down:
yarn start
```
This will start the playground server in port `1234` and open it in browser so you start playing with the playground.
This will start the playground server in port `1234` and open it in browser so you start playing with the playground.
## Update Supported Diagram Types
@@ -26,13 +26,13 @@ For this create a file named `{{diagramType}}.ts` in [`src/parser`](https://gith
The main aim of the parser is :point_down:
1. Determine how elements are connected in the diagram and thus finding arrow and text bindings.
1. Determine how elements are connected in the diagram and thus finding arrow and text bindings.
For this you might have to dig in to the parser `diagram.parser.yy` and which attributes to parse for the new diagram.
2. Determine the position and dimensions of each element, for this would be using the `svg`
Once the parser is ready, lets start using it.
Once the parser is ready, lets start using it.
Add the diagram type in switch case in [`parseMermaid`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L97) and call the parser for the same.
@@ -51,4 +51,3 @@ Thats it, you have added the new diagram type 🥳, now lets test it out!
2. Incase the new diagram type added is present in [`unsupported.ts`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/playground/testcases/unsupported.ts) then remove it from there.
3. Verify if the test cases are running fine in playground.
@@ -8,12 +8,10 @@ In this section we will be diving into how the [flowchart parser](https://github
We use `diagram.parser.yy` attribute to parse the data. If you want to know more about how the `diagram.parse.yy` attribute looks like, you can check it [here](https://github.com/mermaid-js/mermaid/blob/00d06c7282a701849793680c1e97da1cfdfcce62/packages/mermaid/src/diagrams/flowchart/flowDb.js#L768), however for scope of flowchart we are using **3** APIs from this parser to compute `vertices`, `edges` and `clusters` as we need these data to transform to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/transform.ts#L133C13-L133C38).
For computing `vertices` and `edge`s lets consider the below svg generated by mermaid
We use `getVertices` API from `diagram.parse.yy` to get the vertices for a given flowchart.
@@ -42,9 +40,10 @@ Considering the same example this is the response from the API
}
}
```
The dimensions and position is missing in this response and we need that to transform to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/transform.ts#L133C13-L133C38), for this we have our own parser [`parseVertex`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L178) which takes the above response and uses the `svg` together to compute position, dimensions and cleans up the response.
The final output from `parseVertex` looks like :point_down:
The final output from `parseVertex` looks like :point_down:
```js
{
@@ -73,57 +72,55 @@ The dimensions and position is missing in this response and we need that to tran
}
```
## Computing the edges
The lines and arrows are considered as `edges` in mermaid as shown in the above diagram.
We use `getEdges` API from `diagram.parse.yy` to get the edges for a given flowchart.
Considering the same example this is the response from the API
The lines and arrows are considered as `edges` in mermaid as shown in the above diagram. We use `getEdges` API from `diagram.parse.yy` to get the edges for a given flowchart. Considering the same example this is the response from the API
```js
[
{
"start": "start",
"end": "stop",
"type": "arrow_point",
"text": "",
"labelType": "text",
"stroke": "normal",
"length": 1
}
]
{
start: "start",
end: "stop",
type: "arrow_point",
text: "",
labelType: "text",
stroke: "normal",
length: 1,
},
];
```
Similarly here the dimensions and position is missing and we compute that from the svg. The [`parseEdge`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L245) takes the above response along with `svg` and computes the position, dimensions and cleans up the response.
The final output from `parseEdge` looks like :point_down:
The final output from `parseEdge` looks like :point_down:
```js
[
{
"start": "start",
"end": "stop",
"type": "arrow_point",
"text": "",
"labelType": "text",
"stroke": "normal",
"startX": 67.797,
"startY": 22,
"endX": 117.797,
"endY": 22,
"reflectionPoints": [
{
"x": 67.797,
"y": 22
},
{
"x": 117.797,
"y": 22
}
]
}
]
{
start: "start",
end: "stop",
type: "arrow_point",
text: "",
labelType: "text",
stroke: "normal",
startX: 67.797,
startY: 22,
endX: 117.797,
endY: 22,
reflectionPoints: [
{
x: 67.797,
y: 22,
},
{
x: 117.797,
y: 22,
},
],
},
];
```
## Computing the Subgraphs
`Subgraphs` is collection of elements grouped together. The Subgraphs map to `grouping` elements in Excalidraw.
@@ -132,46 +129,35 @@ Lets consider the below example :point_down:
For position and dimensions we use the svg to compute. The [`parseSubgraph`](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/parseMermaid.ts#L139) takes the above response along with `svg` and computes the position, dimensions and cleans up the response.
[This](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/index.ts) is the entry point of the library.
`parseMermaidToExcalidraw` function is the only function exposed which receives mermaid syntax as the input, parses the mermaid syntax and resolves to Excalidraw Skeleton.
Lets look at the high level overview at how the parse works :point_down:
@@ -13,10 +12,10 @@ Lets dive deeper into individual section now to understand better.
## Parsing Mermaid diagram
One of the dependencies of the library is [`mermaid`](https://www.npmjs.com/package/mermaid) library.
We need the mermaid diagram in some extractable format so we can parse it to Excalidraw Elements.
One of the dependencies of the library is [`mermaid`](https://www.npmjs.com/package/mermaid) library. We need the mermaid diagram in some extractable format so we can parse it to Excalidraw Elements.
Parsing is broken into two steps
1. [`Rendering Mermaid to Svg`](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser#rendering-mermaid-to-svg) - This helps in determining the position and dimensions of each element in the diagram
2. [`Parsing the mermaid syntax`](/docs/@excalidraw/mermaid-to-excalidraw/codebase/parser#parsing-the-mermaid-syntax) - We also need to know how elements are connected which isn't possible with svg alone hence we also parse the mermaid syntax which helps in determining the connections and bindings between elements in the diagram.
@@ -27,10 +26,8 @@ Parsing is broken into two steps
The [`mermaid`](https://www.npmjs.com/package/mermaid) library provides the API `mermaid.render` API which gives the output of the diagram in `svg`.
If the diagram isn't supported, this svg is converted to `dataURL` and can be rendered as an image in Excalidraw.
### Parsing the mermaid syntax
For this we first need to process the options along with mermaid defination for diagram provided by the user.
@@ -57,9 +54,8 @@ If you want to understand how flowchart parser works, you can navigate to [Flowc
Now we have all the data, we just need to transform it to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/transform.ts#L133C13-L133C38) API so it can be rendered in Excalidraw.
For this we have `converters` which takes the parsed mermaid data and gives back the Excalidraw Skeleton.
For Unsupported types, we have already mentioned above that we convert it to `dataURL` and return the ExcalidrawImageSkeleton.
For this we have `converters` which takes the parsed mermaid data and gives back the Excalidraw Skeleton. For Unsupported types, we have already mentioned above that we convert it to `dataURL` and return the ExcalidrawImageSkeleton.
For supported types, currently only flowchart, we have [flowchartConverter](https://github.com/excalidraw/mermaid-to-excalidraw/blob/master/src/converter/types/flowchart.ts#L24) which parses the data and converts to [ExcalidrawElementSkeleton](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/transform.ts#L133C13-L133C38).
Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/excalidraw/issues/new) first to discuss what you would like to change.
We have a [roadmap](https://github.com/orgs/excalidraw/projects/3) which we strongly recommend to go through and check if something interests you.
For new contributors we would recommend to start with *Easy* tasks.
We have a [roadmap](https://github.com/orgs/excalidraw/projects/3) which we strongly recommend to go through and check if something interests you. For new contributors we would recommend to start with _Easy_ tasks.
In case you want to pick up something from the roadmap, comment on that issue and one of the project maintainers will assign it to you, post which you can discuss in the issue and start working on it.
@@ -60,10 +59,7 @@ It's also a good idea to consider if your change should include additional tests
Finally - always manually test your changes using the convenient staging environment deployed for each pull request. As much as local development attempts to replicate production, there can still be subtle differences in behavior. For larger features consider testing your change in multiple browsers as well.
:::note
Some checks, such as the `lint` and `test`, require approval from the maintainers to run.
They will appear as `Expected — Waiting for status to be reported` in the PR checks when they are waiting for approval.
:::
:::note Some checks, such as the `lint` and `test`, require approval from the maintainers to run. They will appear as `Expected — Waiting for status to be reported` in the PR checks when they are waiting for approval. :::
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.