Commit Graph

513 Commits

Author SHA1 Message Date
5f195694ee update simplifier distance to reflect zoom (#2004)
* update simplifier distance to reflect zoom

The distance used in the iterative end-point fit algorithm to
determine if points can be removed no longer ignores the
zoom. As the zoom gets larger this distance will get smaller
and fewer points will be removed, thus making for finer grain
control over the drawing. As the zoom gets smaller the drawing
will get more coarse as more points are removed.

* remove the comment

Co-authored-by: John Dupuis <wasp7@Johns-MacBook-Pro.local>
Co-authored-by: Michal Srb <xixixao@seznam.cz>
2020-08-08 18:50:16 -07:00
403e8bd307 clear selection from copied/duplicatated group (#1973)
Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-08-08 22:35:34 +02:00
818821c293 feat: grid mode for line editing (#1984) 2020-07-30 17:09:51 +02:00
c171fb4c7f simplify by replacing draggingElementPointIndex with isDragging (#1982)
* simplify by replacing draggingElementPointIndex with isDragging

* add tsdoc
2020-07-30 12:58:06 +02:00
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
925db9dcca Only insert text on double click when selection is enabled (#1937)
This was an oversight to enable it for all the shapes. I don't believe that we want to be able to insert text on double click when drawing a rectangle for example. And it's definitely a broken experience when doing so for free draw.

Fixes part of #1935
2020-07-27 23:05:52 +02:00
ee8fa6aaad Import and export library from/to a file (#1940)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-27 14:29:19 +02:00
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
a2e7d8d560 feat: rotating multiple elements (#1960) 2020-07-26 12:21:38 +02:00
ebf2923c5e Issues/1827 group-ungroup icons (#1956)
* show group and ungroup action-icon

* change group-icon visiblilty

don't show group if selected is only a single element or a single group of elements

Co-authored-by: rene_mbp <harryloveslearning@googlemail.com>
2020-07-26 01:42:06 +03:00
dc1f6c4d4c change selection/line/draw shortcut defaults (#1953) 2020-07-24 15:47:46 +02:00
c5d37a07c8 fix resize hints not showing due to LayerUI bailing on updates (#1952) 2020-07-24 13:29:36 +02:00
b07aa6e205 delay scene init until document active (#1920)
* delay scene init until document active

* use opts.once for the listener
2020-07-20 12:53:53 +02:00
cf36cb394b Library improvements (#1925)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-07-19 23:12:56 +02:00
c1488fa353 try/catch localStorage access (#1932) 2020-07-17 18:39:23 +02:00
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
953cd5563c move the excalidraw props to correct file and typo fix (#1907) 2020-07-11 15:13:20 +02:00
6428b59ccb Library MVP (#1787)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-07-10 11:20:23 +02:00
7ab0c1aba8 reload scene on hashchange (#1893)
* reload scene on hashchange

* tweak isLoading
2020-07-09 22:16:28 -07:00
4ab4fce998 Refactoring in pointer down event handler, step 3 (#1888)
* Refactor: use pointer down state for alt duplication flag

* Refactor: use pointer down state for drag state

* Refactor: simplify over scrollbars check

* Refactor: move pointer move handler out of pointer down handler

* Refactor: move pointer up handler out of pointer down handler

* Refactor: further simplify scrollbar check state in pointer down event

* Refactor: pull out initial pointer down state creation
2020-07-09 14:15:42 -07:00
5664de0459 Refactoring in pointer down event handler, step 2 (#1887)
* Refactor: introduce pointer down state to replace implicit closure state with an explicit object

* Refactor: use pointer down state for resize handle

* Refactor: use pointer down state for isResizing

* Refactor: use pointer down state for resizing offset

* Refactor: use pointer down state for hit element

* Refactor: move selection handling out of pointer down event handler

* Refactor: move text handling out of pointer down event handler

* Refactor: move linear tools handling out of pointer down event handler

* Refactor: move element creation out of pointer down handler
2020-07-09 09:30:38 -07:00
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
d5e7d08586 prompt when loading external scene before overriding local one (#1862) 2020-07-08 22:55:26 +02:00
df5eb3f0d9 change copy/paste styles shortcuts (#1881)
* change copy/paste styles shortcuts

* use keyCode
2020-07-07 20:22:23 +02:00
9351b2821c feat: add width, height as props to App.tsx (#1871) 2020-07-07 17:10:39 +02:00
b1261eea70 duplicate point on cmd+d (#1831) 2020-07-07 13:53:44 +02:00
84abda82d5 docs: add multiple selection docs (#1875) 2020-07-07 11:24:07 +02:00
cc52ea4ac2 Add support for long press to context menu on iOS (#1769)
* Initial support for touch context menu

* Only deal with touch if it's available

* Fix touch checking

* Remove touch checking

* Added comments

* Combine onTouch with onPointer for mobile context menu support
2020-07-03 00:12:56 +03:00
b21f723eee use absolute positioning instead of fixed (#1860) 2020-07-02 15:27:47 +02:00
0a3fb70ec7 Dynamicaly import locales (#1793)
* dynamicly import locales

* fix tests

* reformat languages
2020-06-27 12:02:54 +01:00
5970bb7ee9 Remove duplicate string for toggle grid mode (#1821) 2020-06-26 22:28:01 +02:00
1991511ef7 Fix flickering outline on the dialogs while clicking (#1747) 2020-06-26 22:27:16 +02:00
cd87bd6901 do not center text when not applicable (#1783) 2020-06-25 21:21:27 +02:00
9c89504b6f fix: start dragging grouped elements (#1818)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-24 13:38:42 +02:00
baa8fb6c14 grid support (1st iteration) (#1788)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-23 17:24:52 +02:00
a357d00bbe Hint for shortcut for moving the visible area (#1784) 2020-06-19 22:28:13 +02:00
ca87ca6fe9 Add user list component + snap to user functionality (#1749) 2020-06-19 12:36:49 +02:00
5d3867d8ac Implement Save without re-prompt and Save as (#1709)
* Implement Save without re-prompt and Save as
Fixes #1668

* Add save-as icon

* Make .excalidraw the default extension

* Only show save as button on supporting browsers
2020-06-12 18:35:04 +02:00
998f0ae458 remove z-index for color-picker-hash div (#1711) 2020-06-08 06:52:54 -04:00
60973f6dc5 rename container class to excalidraw and move css from index.html to app.css (#1729)
Moved the css from index.html to app.css so it can be included in upstream app as well
2020-06-08 13:36:35 +03:00
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
f7c4efbd35 Excalicharts MVP (#1723)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-06-06 22:09:04 +02:00
fd75b88bd3 Double finger zoom should not select things (#1333) 2020-06-02 19:41:40 +03:00
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
f413bab3de Fix group element removing (#1676) 2020-05-30 13:48:57 -07:00
17e9cc4506 Some cleanup in App.tsx (#1681) 2020-05-30 15:26:17 +02:00
fa359034c5 scroll the closest element to center (#1670)
Co-authored-by: Sanghyeon Lee <yongdamsh@gmail.com>
2020-05-30 14:02:32 +02:00
44a88d2d58 Rewrite restore to guard against missing migrations (#1664) 2020-05-28 02:41:34 -07:00
5327e8a3dc fix language change not rerendering ui (#1638) 2020-05-27 16:46:11 +02:00
63c10743fb split font into fontSize and fontFamily (#1635) 2020-05-27 15:14:50 +02:00