223 Commits

Author SHA1 Message Date
Pete Hunt
d0985fe67a
Persistent rooms via Firebase (#2188)
* Periodically back up collaborative rooms in firebase

* Responses to code review

* comments from code review, new firebase credentials
2020-10-04 11:12:47 -07:00
Robert van Hoesel
c6736fa14e
Lock drag direction using Shift (#1858)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-09-11 17:22:40 +02:00
David Luzar
d07099aadd
fix zindex to account for group boundaries (#2065) 2020-09-11 17:06:07 +02:00
David Luzar
aaddde5dd9
Fix history initialization (#2115) 2020-09-09 21:08:06 +02:00
Mohamed Saleh
9cac7816cc
Fix textbox element bindings on size changes (#2145)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-09-08 18:03:49 +02:00
Michal Srb
15e4b51bb1
Fix binding disabling when taking screenshots on macOS (#2129)
* Fix binding disabling when taking screenshots on macOS
* Update snapshot for cmd+click test
2020-09-03 16:12:01 +02:00
Michal Srb
7ebeae2d38
Fix arrow rebinding on rotation (take 2) (#2104)
* Clear up test, fix simple rotation
* Fix eligibility rules
2020-08-29 17:56:03 +02:00
Daishi Kato
84c49ebaa1
Support rotating two-point lines (angle can be non-zero) (#2090)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-08-28 10:20:06 +02:00
João Forja
e7d186b439
Fix drag multiple elements bug (#2023)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-26 18:37:44 +02:00
Pedro Baracho
e34cf3aee3
Fix #2075 - Pinch zooming while typing text breaks the UI on Chrome Mac OS X (#2076) 2020-08-25 11:38:03 +02: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
Michal Srb
c0dd870c6e
Dark mode (#2006)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-13 13:35:31 +02:00
João Forja
296e3677cf
Fix single element bounding box bug (#2008)
Co-authored-by: Michal Srb <xixixao@seznam.cz>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-11 12:42:08 +02:00
David Luzar
964746e569
fix transform handles regression (#2018) 2020-08-10 15:00:21 +02:00
David Luzar
950bcd0b72
Refactor resize handle naming (#2013) 2020-08-10 14:16:39 +02:00
Michal Srb
8bbeb32e87
Fix text selection broken by PR1899 (#2011) 2020-08-09 00:51:41 -07: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
fea257765d
regenerate seed on change of sloppiness (#1986) 2020-07-30 20:14:38 +02:00
Daishi Kato
818821c293
feat: grid mode for line editing (#1984) 2020-07-30 17:09:51 +02:00
David Luzar
c171fb4c7f
simplify by replacing draggingElementPointIndex with isDragging (#1982)
* simplify by replacing draggingElementPointIndex with isDragging

* add tsdoc
2020-07-30 12:58:06 +02:00
Aakansha Doshi
20500b7822
remove shared global scene and attach it to every instance (#1706)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-30 11:20:59 +02:00
David Luzar
ab980b252c
make restore migration types required (#1977) 2020-07-28 23:40:06 +02:00
Aakansha Doshi
7eff6893c5
calculate coords based on container viewport position (#1955)
* feat: calculate coords based on parent left and top so it renders correctly in host App

* fix text

* move offsets to state & fix bugs

* fix text jumping

* account for zoom in textWysiwyg & undo incorrect offsetting

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-27 13:48:49 +02: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
Mohammed Salman
bac20fa641
Choosing color before entering text does not update the swatch (Fixes #1897) (#1915)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-14 13:56:45 +02:00
Aakansha Doshi
953cd5563c
move the excalidraw props to correct file and typo fix (#1907) 2020-07-11 15:13:20 +02:00
Daishi Kato
6cc6e13892
adjust font baseline on resize (#1820)
* adjust font baseline on resize

* simplify font scaling on resize

* fix: resizing text to avoid glitchy behavior

* make text resizing deterministic

* no TEXT_WIDTH_PADDING hack

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-09 22:22:10 +09:00
Michal Srb
5d7020cce6
Refactoring in pointer down event handler (#1880)
* Refactor: Move context menu touch device handling

* Refactor: Move more stuff out of pointer down

* Refactor: Move last coords into an object

* Refactor: Move scrollbar handling out of pointer down

* Refactor: simplify resizing in pointer down

* Refactor: further simplify resizing in pointer down

* Refactor: clarify clearing selection code

* Refactor: move out clearing selection from pointer down

* Refactor: further simplify deselection in pointer down
2020-07-08 22:07:51 -07:00
Aakansha Doshi
9351b2821c
feat: add width, height as props to App.tsx (#1871) 2020-07-07 17:10:39 +02:00
David Luzar
cd87bd6901
do not center text when not applicable (#1783) 2020-06-25 21:21:27 +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
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
David Luzar
d1be2a5481
fix text constructor groupIds & improve type safety (#1715) 2020-06-06 13:32:43 +02:00
fujimoto kyosuke
476c0e9f8a
Fix undo with line editing (#1717) 2020-06-05 17:11:24 +02: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
David Luzar
f413bab3de
Fix group element removing (#1676) 2020-05-30 13:48:57 -07:00
Aakansha Doshi
fa359034c5
scroll the closest element to center (#1670)
Co-authored-by: Sanghyeon Lee <yongdamsh@gmail.com>
2020-05-30 14:02:32 +02:00
David Luzar
44a88d2d58
Rewrite restore to guard against missing migrations (#1664) 2020-05-28 02:41:34 -07:00
Pete Hunt
56f8bc092d
Tests for groups, more test utils (#1669) 2020-05-28 10:56:18 +02:00
David Luzar
4f3bf79708
skip element mutation on noop updates (#1667) 2020-05-28 00:50:56 -07: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
David Luzar
35049e3de7
History tweaks (#1641)
Co-authored-by: Pete Hunt <phunt@twitter.com>
2020-05-24 15:17:14 -07:00
Timur Khazamov
d315e3dc4d
Update TypeScript to 3.9.3 (#1640)
Co-authored-by: tk338g <tkhazamov@wayfair.com>
2020-05-24 21:17:25 +02:00
Pete Hunt
6512ede9ca
Optimize undo history (#1632)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-23 12:07:11 -07:00
Daishi Kato
51608c07b0
15-degree rotation locking (#1627) 2020-05-23 10:45:05 +02: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