Commit Graph

153 Commits

Author SHA1 Message Date
cd87bd6901 do not center text when not applicable (#1783) 2020-06-25 21:21:27 +02:00
3cee0768cc Null file handle doesn’t need to be passed (#1752)
* Bump browser-nativefs version to v0.2.0

In reply to https://github.com/tomayac/browser-nativefs/issues/2.

* Update package-lock.json

* Null file handle doesn’t need to be passed
2020-06-15 12:23:23 +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
ff93d95998 Revert "Fix RTL text direction rendering (#1687)" (#1705)
This reverts commit a118bed82f.
2020-06-03 12:12:43 +02:00
a118bed82f Fix RTL text direction rendering (#1687)
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-06-02 21:31:34 +03: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
63c10743fb split font into fontSize and fontFamily (#1635) 2020-05-27 15:14:50 +02:00
61e5b66dac Group/ungroup (#1648)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-26 13:07:46 -07:00
d315e3dc4d Update TypeScript to 3.9.3 (#1640)
Co-authored-by: tk338g <tkhazamov@wayfair.com>
2020-05-24 21:17:25 +02:00
d2ae18995c add history.shouldCreateEntry resolver (#1622) 2020-05-22 22:26:59 -07:00
c427aa3cce Prefer arrow functions and callbacks (#1210) 2020-05-20 15:21:37 +02:00
39c56a4c01 implement stroke style (#1571) 2020-05-14 17:04:33 +02:00
9ec43d2626 Add free draw mode (#1570) 2020-05-12 21:10:11 +02:00
e27f3f9ad2 fix(data): removes unnecessary await (#1549) 2020-05-06 21:18:49 +02:00
5822117e23 Add optional watermark on export (#1365)
* Add optional watermark on export

* Address init PR feedback

* Add SVG export with refactoring

* Update export.ts

* Move addWatermark to appState

* Update snapshots

* Fit watermark in small scene

* Rename watermark things

Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-19 12:50:23 -07:00
c35d76cb4c Use application/vnd.excalidraw+json and .excalidraw (#1440)
* Use application/vnd.excalidraw+json and .excalidraw

* UA sniff and use appication/json on mobile Safari
2020-04-16 17:55:49 +02:00
2adae4132b Global username instead of per room (#1382)
* global username

* remove string interpolation

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

* remove string interpolation

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

* remove backwards compat

Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-11 21:23:12 +01:00
7b3816d0d3 Store username for every room (#1381)
* store username for every room

* add missing fun
2020-04-11 19:13:10 +03:00
b971737d32 Restore textAlign property (#1374) 2020-04-11 10:59:22 +02:00
0a284adc18 Allow opening empty excalidraw file (#1348)
* allow openning empty file

* correctly throw error

* fix error handling

* switch back to error objects

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-10 11:58:09 +02:00
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
df0613d8ac Add NonDeleted<ExcalidrawElement> (#1068)
* add NonDeleted

* make test:all script run tests without prompt

* rename helper

* replace with helper

* make element contructors return nonDeleted elements

* cache filtered elements where appliacable for better perf

* rename manager element getter

* remove unnecessary assertion

* fix test

* make element types in resizeElement into nonDeleted

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-08 18:49:52 +02:00
67805bc7a7 Add collaborators names (#1223)
* add random usernames

* add username state

* add username input

* ability to set names

* fix tests

* set username oon mobile

* remove auto generated names

* remove commented code

* always string

* updaate snapshots

* maintain username when clearing canvas

* Update src/renderer/renderScene.ts

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

* add border

* fix styles

Co-authored-by: Pete Hunt <petehunt@users.noreply.github.com>
Co-authored-by: Faustino Kialungila <faustino.kialungila@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-07 14:02:42 +01:00
22160f50d3 Wrap localStorage API Access in try-catch (#1241) 2020-04-07 13:09:37 +03:00
d5366db341 Adding ability to copy to clipboard as SVG (#1250) 2020-04-06 02:13:17 +03:00
b97520400a Broadcast mouse activity (#1175)
* broadcast mouse activity

* move to same MOUSE_LOCATION event

* remove key up handler

* update tests

* Fix border

* refactor

* rename activity to button

Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-04-04 17:12:19 +02:00
23540eba4c sync remote selection (#1207)
* sync remote selection

* skip deleted elements

* remove unnecessary condition & change naming
2020-04-04 16:02:16 +02:00
0c9459e9e5 Warn on invalid JSON file (#1159)
* add error dialog

* show error modal on file dnd

* add locales

* Update src/locales/en.json

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

* Update src/data/blob.ts

* Update src/data/blob.ts

* fix titles, update snapshots

* make modal smaller

* fix dnd wrong file type

* reset errorMessage

Co-authored-by: Faustino Kialungila <faustino.kialungila@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-03 13:50:51 +02:00
65be7973be Rotation support (#1099)
* rotate rectanble with fixed angle

* rotate dashed rectangle with fixed angle

* fix rotate handler rect

* fix canvas size with rotation

* angle in element base

* fix bug in calculating canvas size

* trial only for rectangle

* hitTest for rectangle rotation

* properly resize rotated rectangle

* fix canvas size calculation

* giving up... workaround for now

* **experimental** handler to rotate rectangle

* remove rotation on copy for debugging

* update snapshots

* better rotation handler with atan2

* rotate when drawImage

* add rotation handler

* hitTest for any shapes

* fix hitTest for curved lines

* rotate text element

* rotation locking

* hint messaage for rotating

* show proper handlers on mobile (a workaround, there should be a better way)

* refactor hitTest

* support exporting png

* support exporting svg

* fix rotating curved line

* refactor drawElementFromCanvas with getElementAbsoluteCoords

* fix export png and svg

* adjust resize positions for lines (N, E, S, W)

* do not make handlers big on mobile

* Update src/locales/en.json

Alright!

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

* do not show rotation/resizing hints on mobile

* proper calculation for N and W positions

* simplify calculation

* use "rotation" as property name for clarification (may increase bundle size)

* update snapshots excluding rotation handle

* refactor with adjustPositionWithRotation

* refactor with adjustXYWithRotation

* forgot to rename rotation

* rename internal function

* initialize element angle on restore

* rotate wysiwyg editor

* fix shift-rotate around 270deg

* improve rotation locking

* refactor adjustXYWithRotation

* avoid rotation degree becomes >=360

* refactor with generateHandler

Co-authored-by: Lipis <lipiridis@gmail.com>
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-02 10:40:26 +02:00
763735ac84 Add SCENE_INIT broadcast type for new user (#1095) 2020-03-28 19:35:56 -07:00
12d7550958 fixed generateCollaborationLink() (#1081) 2020-03-25 17:18:22 +02:00
bd7856adf3 Much more thorough tests! (#1053) 2020-03-23 16:38:41 -07:00
722c498abe Bump prettier from 1.19.1 to 2.0.1 (#1060)
* Bump prettier from 1.19.1 to 2.0.1

Bumps [prettier](https://github.com/prettier/prettier) from 1.19.1 to 2.0.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/1.19.1...2.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update formatting

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-03-23 13:05:07 +02:00
0ad6f4ec6b Remove deleted elements from svg export (#1021)
* Remove deleted elements from svg export

* skip deleted elements

* remove old comment

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-03-20 15:19:20 +01:00
82ce068972 fix history (#1009)
* fix history

* tweak withBatchedUpdates typing
2020-03-19 14:51:05 +01:00
373d16abe6 improve & granularize ExcalidrawElement types (#991)
* improve & granularize ExcalidrawElement types

* fix incorrectly passing type

* fix tests

* fix more tests

* fix unnecessary spreads & refactor

* add comments
2020-03-17 20:55:40 +01:00
db1f97f59e Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972)
This reverts commit dcb93f75e6.
2020-03-16 00:38:37 -07:00
dcb93f75e6 [RFC] Randomized names next to mouse pointers. (#971)
* [WIP] Add names next to pointers

This implements the rendering and messaging across. Still need to do the UI to set the name.

Also, not really sure what's the best place to send the name and store it.

* Add randomized names

Co-authored-by: Christopher Chedeau <vjeux@fb.com>
2020-03-15 18:56:38 -07:00
e1e2249f57 Abstract away or eliminate most of the mutation of the Elements array (#955) 2020-03-14 21:48:51 -07:00
3f8144ef85 Fix many syncing issues (#952) 2020-03-14 20:46:57 -07:00
b9c75b5bc4 use deletedIds map to sync deletions (#936)
* use deletedIds map for sync deletions

* refactor how we create data for syncing

* fix comments

* streamline broadcast API

* split broadcast methods
2020-03-14 21:25:07 +01:00
642e47bd03 Merge remote-tracking branch 'origin/master' into fix_multiplayer_concurrency 2020-03-12 21:49:54 +01:00
37284c9174 Merge pull request #915 from excalidraw/fix_remote_pointers
remove remote pointers on client disconnect
2020-03-12 12:18:27 -07:00
f1ac8cac32 remove unused selectedId 2020-03-12 20:02:10 +01:00
3a5ca27600 fix zero-coalescing roughness (#924) 2020-03-12 17:49:11 +01:00
5706dd7ae2 consolidate & align collaboration socket eventing with server 2020-03-12 12:19:56 +01:00
b82b0754ac Room dialog (#905)
* support ToolIcon className and fix label padding

* factor some ExportDialog classes out to Modal

* initial RoomDialog prototype

* change label for another-session button

* remove unused css

* add color comments

* Move the collaboration button to the main menu, add support for mobile

* remove button for creating another session

* add locks

* Fix alignment issue

* Reorder button

* reuse current scene for collab session

* keep collaboration state on restore

Co-authored-by: Jed Fox <git@twopointzero.us>
2020-03-11 19:42:18 +01:00
83a2f5de28 remove closures from mutateElement, get rid of the element spreading (#902) 2020-03-10 20:11:02 -07:00
13b838117c filter out selection elements on restore (#901)
* filter out selection elements on restore

* add comment
2020-03-10 19:41:41 +01:00