107 Commits

Author SHA1 Message Date
Arun
4e421e6e9e
feat: Support exporting with dark mode (#3046)
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2021-02-24 15:22:17 +01:00
Aakansha Doshi
9c0f832a41
fix: show user state only when passed from host (#3050) 2021-02-16 15:08:27 +05:30
Aakansha Doshi
e63a0ec5be
feat: allow host to pass color for collaborators (#2943)
* feat: allow host to pass color for collaborators

* remove user prop as its not used anywhere

* update changelog and readme

* add pr link
2021-02-06 23:33:52 +05:30
Thomas Steiner
1a67642fd1
chore: [Idle detection] Deal with users on systems that don't handle emoji (#2941)
* Deal with users on systems that don't handle emoji

* Leave no trailing space

* Move function to utils, and actually call it 🤣
Chapeau, TypeScript!

* Use grinning face instead of koala

* Tweak globalAlpha
2021-02-05 18:34:35 +01:00
Thomas Steiner
1837147c55
feat: Add idle detection to collaboration feature (#2877)
* Start idle detection implementation

* First working version

* Add screen state

* Add type safety

* Better rendering, enum types, localization

* Add origin trial token

* Fix

* Refactor idle detection to no longer use IdleDetector API

* Cleanup some leftovers

* Fix

* Apply suggestions from code review

* Three state: active 🟢, idle 💤, away ️

* Address feedback from code review
Thanks, @lipis

* Deal with unmount

Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2021-02-04 11:55:43 +01:00
Aakansha Doshi
675da16ca4
feat: add view mode in Excalidraw (#2840)
Co-authored-by: Lipis <lipiridis@gmail.com>
2021-02-01 21:56:42 +01:00
David Luzar
e75f5f20e7
fix: remote pointers not accounting for offset (#2855) 2021-01-25 10:47:48 +01:00
João Forja
4c7b1a2269
fix: Visibility and zooming when canvas offset is not zero (#2534) 2020-12-14 15:14:56 +01:00
Steve Ruiz
9cf54041dc
Expand canvas padding based on zoom. (#2515) 2020-12-12 16:34:36 +01:00
Steve Ruiz
c742225f43
More Arrowheads: dot, bar (#2486)
Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-11 18:17:28 +01:00
Steve Ruiz
c291edfc44
Add Arrowheads to Arrows (#2452)
Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-12-08 16:02:55 +01:00
Christopher Chedeau
533815c081
Fix middle handles on mobile (#2459)
For rendering we always use mouse in order to check which handles to display but when doing the hit test, we used pointer which has a different size. So we couldn't use the middle handles for small shapes. This is now fixed.

cc @j-f1 as you added it in #790
2020-12-05 16:35:44 -08:00
Lipis
b21fd49412
chore: Minor refactoring for consistency (#2425) 2020-11-29 17:32:51 +01:00
Lipis
a20f3240fd
Prefer arrow functions (#2344) 2020-11-06 21:06:39 +01:00
Lipis
5d295415db
Keep errors, elements and comments consistent (#2340)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-11-05 18:06:18 +01:00
João Forja
566e6a5ede
Zoom on cursor | Issue #940 (#2319) 2020-11-04 19:49:15 +02:00
Michal Srb
8a10f2a0b8
Fix collision check for rectangles and rendering of binding area (#2221) 2020-10-11 09:46:13 +03:00
Daishi Kato
41cb1fbeba
feat: sharpness (#1931)
* feat: sharpness

* feat: fill sharp lines, et al.

* fix: rotated positioning

* chore: simplify path with Q

* fix: hit test inside sharp elements

* make sharp / round buttons work properly

* fix tsc tests

* update snapshots

* update snapshots

* fix: sharp arrow creation error

* fix merge and test

* avoid type assertion

* remove duplicate helper

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-14 17:59:43 +02:00
David Luzar
950bcd0b72
Refactor resize handle naming (#2013) 2020-08-10 14:16:39 +02:00
Michal Srb
26f67d27ec
Allow binding linear elements to other elements (#1899)
* Refactor: simplify linear element type

* Refactor: dedupe scrollbar handling

* First step towards binding - establish relationship and basic test for dragged lines

* Refactor: use zoom from appstate

* Refactor: generalize getElementAtPosition

* Only consider bindable elements in hit test

* Refactor: pull out pieces of hit test for reuse later

* Refactor: pull out diamond from hit test for reuse later

* Refactor: pull out text from hit test for reuse later

* Suggest binding when hovering

* Give shapes in regression test real size

* Give shapes in undo/redo test real size

* Keep bound element highlighted

* Show binding suggestion for multi-point elements

* Move binding to its on module with functions so that I can use it from actions, add support for binding end of multi-point elements

* Use Id instead of ID

* Improve boundary offset for non-squarish elements

* Fix localStorage for binding on linear elements

* Simplify dragging code and fix elements bound twice to the same shape

* Fix binding for rectangles

* Bind both ends at the end of the linear element creation, needed for focus points

* wip

* Refactor: Renames and reshapes for next commit

* Calculate and store focus points and gaps, but dont use them yet

* Focus points for rectangles

* Dont blow up when canceling linear element

* Stop suggesting binding when a non-compatible tool is selected

* Clean up collision code

* Using Geometric Algebra for hit tests

* Correct binding for all shapes

* Constant gap around polygon corners

* Fix rotation handling

* Generalize update and fix hit test for rotated elements

* Handle rotation realtime

* Handle scaling

* Remove vibration when moving bound and binding element together

* Handle simultenous scaling

* Allow binding and unbinding when editing linear elements

* Dont delete binding when the end point wasnt touched

* Bind on enter/escape when editing

* Support multiple suggested bindable elements in preparation for supporting linear elements dragging

* Update binding when moving linear elements

* Update binding when resizing linear elements

* Dont re-render UI on binding hints

* Update both ends when one is moved

* Use distance instead of focus point for binding

* Complicated approach for posterity, ignore this commit

* Revert the complicated approach

* Better focus point strategy, working for all shapes

* Update snapshots

* Dont break binding gap when mirroring shape

* Dont break binding gap when grid mode pushes it inside

* Dont bind draw elements

* Support alt duplication

* Fix alt duplication to

* Support cmd+D duplication

* All copy mechanisms are supported

* Allow binding shapes to arrows, having arrows created first

* Prevent arrows from disappearing for ellipses

* Better binding suggestion highlight for shapes

* Dont suggest second binding for simple elements when editing or moving them

* Dont steal already bound linear elements when moving shapes

* Fix highlighting diamonds and more precisely highlight other shapes

* Highlight linear element edges for binding

* Highlight text binding too

* Handle deletion

* Dont suggest second binding for simple linear elements when creating them

* Dont highlight bound element during creation

* Fix binding for rotated linear elements

* Fix collision check for ellipses

* Dont show suggested bindings for selected pairs

* Bind multi-point linear elements when the tool is switched - important for mobile

* Handle unbinding one of two bound edges correctly

* Rename boundElement in state to startBoundElement

* Dont double account for zoom when rendering binding highlight

* Fix rendering of edited linear element point handles

* Suggest binding when adding new point to a linear element

* Bind when adding a new point to a linear element and dont unbind when moving middle elements

* Handle deleting points

* Add cmd modifier key to disable binding

* Use state for enabling binding, fix not binding for linear elements during creation

* Drop support for binding lines, only arrows are bindable

* Reset binding mode on blur

* Fix not binding lines
2020-08-08 21:04:15 -07:00
David Luzar
f295550940
ensure editingLinearElement handles are rendered on top (#1967) 2020-07-26 20:52:25 +02:00
Daishi Kato
a2e7d8d560
feat: rotating multiple elements (#1960) 2020-07-26 12:21:38 +02:00
Daishi Kato
caa9b54893
do not render grid on export (#1814) 2020-06-24 10:16:03 +02:00
Daishi Kato
baa8fb6c14
grid support (1st iteration) (#1788)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-23 17:24:52 +02:00
Daishi Kato
482fa2d90f
fix visibility check on rotated elements (#1799) 2020-06-22 10:00:09 +02:00
Oliver Benns
ca87ca6fe9
Add user list component + snap to user functionality (#1749) 2020-06-19 12:36:49 +02:00
David Luzar
dadf054ea2
fix not always generating shape on render (#1741) 2020-06-09 17:36:25 +02:00
Daishi Kato
53ab46126d
support resizing multiple elements including texts (#1726)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-06-08 11:25:20 +02:00
Youness Fkhach
d171e9705d
Fix RTL text direction rendering (reopened) (#1722)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-07 11:55:08 +02:00
David Luzar
ff93d95998
Revert "Fix RTL text direction rendering (#1687)" (#1705)
This reverts commit a118bed82f898a365cf5f71ed32f69f51fd08a47.
2020-06-03 12:12:43 +02:00
Youness Fkhach
a118bed82f
Fix RTL text direction rendering (#1687)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-06-02 21:31:34 +03:00
David Luzar
14a66956d7
Implement line editing (#1616)
* implement line editing

* line editing with rotation

* ensure adding new points is disabled on point dragging

* fix hotkey replacement

* don't paint bounding box when creating new multipoint

* tweak points style, account for zoom and z-index

* don't persist editingLinearElement to localStorage

* don't mutate on noop points updates

* account for rotation when adding new point

* ensure clicking on points doesn't deselect element

* tweak history handling around editingline element

* update snapshots

* refactor pointerMove handling

* factor out point dragging

* factor out pointerDown

* improve positioning with rotation

* revert to use roughjs for calculating points bounds

* migrate from storing editingLinearElement.element to id

* make GlobalScene.getElement into O(1)

* use Alt for adding new points

* fix adding and deleting a point with rotation

* disable resize handlers & bounding box on line edit

Co-authored-by: daishi <daishi@axlight.com>
2020-06-01 11:35:44 +02:00
Daishi Kato
7edcea9a93
feat: resize text element (#1650)
* feat: resize text element

* ignore small font size change that leads jankiness

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-28 07:17:15 +09:00
David Luzar
63c10743fb
split font into fontSize and fontFamily (#1635) 2020-05-27 15:14:50 +02:00
Pete Hunt
61e5b66dac
Group/ungroup (#1648)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-26 13:07:46 -07:00
Preet
584e4182a7
Ensure arrows are not draggable from inside (#1620) 2020-05-21 21:57:54 +02:00
Lipis
c427aa3cce
Prefer arrow functions and callbacks (#1210) 2020-05-20 15:21:37 +02:00
Daishi Kato
6b628bb1a6
fix: resize non solid lines/arrows/draws (#1608) 2020-05-17 16:01:35 +02:00
David Luzar
39c56a4c01
implement stroke style (#1571) 2020-05-14 17:04:33 +02:00
Simonboeuf1
ece631b430
preserve spaces in text blocks in svg export (#1587) 2020-05-13 14:30:53 +02:00
Kostas Bariotis
9ec43d2626
Add free draw mode (#1570) 2020-05-12 21:10:11 +02:00
David Luzar
2c5c770e78
rewrite picker color handling (#1487) 2020-04-25 23:06:16 +02:00
David Luzar
6771b505ad
rewrite wysiwyg property updating (#1387)
* rewrite wysiwyg property updating

* reuse existing class

* fix case of focus being stolen by other UIs

* revert mistake csp removal

* ensure we don't run cleanup twice

* fix opacity updating

* add shape actions menu class to constants
2020-04-12 15:57:57 +02:00
fujimoto kyosuke
6abcb2d87f
Suppresses unnecessary fill-rule attribute in SVG (#1397) 2020-04-12 00:03:49 -07:00
fujimoto kyosuke
8b805d436f
Fix fill of looping lines in exported SVG (#1396) 2020-04-11 19:46:46 -07:00
fujimoto kyosuke
166ad0412c
Fix to reflect textAlign property to SVG export (#1375) 2020-04-11 19:17:20 +03:00
Kostas Bariotis
5e2f164026
PoC: Expose wysiwyg element to manipulate from outside (#1356)
* expose wysiwyg element to manipulate from outside

* keep focus after changing style

* update editingElement correctly

* remove mistake

* update text only

* proper check for element

* udpate snapshots

* add error log

* remove try catch handler

* remove blur event

* add proper types

* merge if condition

* simplify if condition

Co-Authored-By: Lipis <lipiridis@gmail.com>

Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: Fausto95 <faustino.kialungila@gmail.com>
2020-04-11 18:10:56 +02:00
Jed Fox
f7e3ee2064
Use open-color directly (#1371) 2020-04-11 01:09:29 +03:00
Preet
57bbc9fe55
Fill a looped curve with the selected background color (#1315) 2020-04-09 11:46:47 +03:00
Youness Fkhach
ff82d1cfa3
feat/ability to change the alignment of the text (#1213)
* feat: add the ability to change the alignement of the text

* test: update the snapshots to included the newely textAlign state

* style: use explicit key assignment to object

* test: add missing new key textAlign to newElement.test.ts

* style: make the text on the buttons start with uppercase

* Update src/locales/en.json

* add types

* add migration

* remove incorrect update

Co-authored-by: Youness Fkhach <younessfkhach@porotonmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-08 22:00:27 +02:00