Commit Graph

350 Commits

Author SHA1 Message Date
57bbc9fe55 Fill a looped curve with the selected background color (#1315) 2020-04-09 11:46:47 +03:00
fe6f482e96 Optimize ShortcutsDialog style (#1329)
* Optimize ShortcutsDialog style

* Add word-break only to ShortcutKey
2020-04-09 11:23:10 +03: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
fdebb38bf6 Move more stuff to Portal (#1309) 2020-04-08 10:18:56 -07: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
26facfa710 Fix 'Dialog' keydown event and prop type warning (#1305) 2020-04-08 15:31:40 +03:00
9a1af38c97 Begin extracting collaboration code to Portal (#1306) 2020-04-07 15:29:43 -07:00
5b684495ef Translate click and change label (#1299) 2020-04-07 16:40:37 +03: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
0c3d34261e Fixes in Shortcuts dialog and minor refactor (#1297) 2020-04-07 14:39:06 +03:00
e4c154f43e Button for shortcuts (#1253) 2020-04-07 13:42:10 +03:00
22160f50d3 Wrap localStorage API Access in try-catch (#1241) 2020-04-07 13:09:37 +03:00
2cc1105ff5 Resize multiple elements (rectangles, diamonds and ellipses onl… (#1193)
* experiment resizing multiple elements

* hack common component

* calculate scale properly (still se only)fg

* prioritize multi selection

* take handle offset into calculation

* fix master merge

* refactor resizeElements out from App

* wip: handlerRectanglesFromCoords

* fix test with type assertion

* properly show handles wip

* revert previous one and do a tweak

* remove unnecessary assignments

* replace hack code with good one

* refactor coords in arg

* resize NW

* resize from sw,ne

* fix with setResizeHandle

* do not show hint while resizing multiple elements

* empty commit

* fix format
2020-04-07 10:49:59 +02:00
e9b4700bba edit text when clicked on with text tool (#1283) 2020-04-06 22:26:54 +02:00
d3ed5a42fc fix font being reset to current state font on edit (#1282) 2020-04-06 22:26:00 +02:00
0c41f3e7aa Add curved lines/arrows shortcuts (#1274) 2020-04-06 17:26:05 +03:00
60d9567e2d Add Select All shortcut (#1270) 2020-04-06 15:07:28 +03:00
18f0b76231 Bump prettier from 2.0.2 to 2.0.3 (#1263)
* Bump prettier from 2.0.2 to 2.0.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.0.2 to 2.0.3.
- [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/2.0.2...2.0.3)

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

* Format

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
2020-04-06 14:21:07 +03:00
d5366db341 Adding ability to copy to clipboard as SVG (#1250) 2020-04-06 02:13:17 +03:00
2de4fe29ad Full Screen mode (#1212) 2020-04-06 00:47:13 +03:00
9a0889c698 Show shortcuts dialog when pressing ? (#1224) 2020-04-05 15:58:00 +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
adc099ed15 Refactor dnd event handler (#1221) 2020-04-04 15:27:53 +02:00
d243f3901c Insert text on double tap (#1217)
* Insert text on double tap(mobile)

* handleCanvasRef
2020-04-04 14:55:36 +02:00
030954badb shift locking 22.5 degree and move to constants (#1216)
* shift locking 22.5 degree and move to constants #1171

* review SHIFT_LOCKING_ANGLE
2020-04-04 14:55:22 +03:00
3afb4515b6 scroll to content on collab scene init (#1201) 2020-04-03 22:22:26 +03:00
036978b837 fix font not rendered on init in FF (#1197) 2020-04-03 22:21:40 +03:00
96cea9b84b Make left panel height flexible to avoid overflow (#1169)
* Make overall left menu scrollable

* Make only mid-left panel scrollable

* Update src/styles.scss

* Update src/styles.scss

* Update src/components/LayerUI.tsx

* Remove unused class

* Move the scrolling role to Island

Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-03 13:58:50 -04:00
ae655cd7d3 Align ToolButton Label in RTL mode (#1186) 2020-04-03 17:24:25 +03:00
4912a29e75 sync intermediate text updates (#1174)
* sync intermediate text updates

* fix initial render text position

* batch updates

* tweak onChange subscription
2020-04-03 14:16:14 +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
27075b028c Update zoom refresh (#1180)
One second feels way too long. Let's try 300ms
2020-04-02 23:56:14 -07:00
79557676c2 Revert "simulate a db tap on mobile to insert text (#1155)" (#1179)
This reverts commit 56034eacb0.
2020-04-02 23:47:39 -07:00
663526129a Proper RTL support (#1154)
* Add RTL styles. Most of the work is done by the browser 💖

* Refactor getLanguage

* Additional fixes

* Mirror the mouse pointer icon

* Move the vertical scrollbar to the left on RTL

* Revert "Mirror the mouse pointer icon"

This reverts commit f69b132538038d231b1b1acc0d6f4a28c91130bb.
2020-04-02 12:21:19 -04:00
8fea75b84f fix for #1106 - Weird behavior when resize + shift a 2-point li… (#1152)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-02 11:46:05 +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
634410ad48 Modify action buttons visibility for desktop (#1156) 2020-04-02 09:52:24 +02:00
56034eacb0 simulate a db tap on mobile to insert text (#1155) 2020-04-01 21:44:09 +02:00
86d0da5204 Add duplicate button for mobile view (#1146)
* Add a icon for dulplication

* Add PanelComponent for duplication

* Add duplicate button for mobile

* Add styles for layout action buttons

* Add a translation for 'Actions'

* Show left action buttons only for desktop

* Add duplicate button at the bottom of mobile

It is provided depending on whether or not it is `multiElement` to maintain space between buttons.
2020-04-01 18:13:53 +03:00
81d4f611a3 add action ui for deleting an element - #1125 (#1140) 2020-03-31 11:54:42 +03:00
4ecbbab7da Add sentry integration (#1141) 2020-03-31 11:37:51 +03:00
a7bd21ccf2 Avoid broadcasting what was just received (#1116)
Fixes #1115

The issue is that replaceAllElements calls a render synchronously, preventing lastBroadcastedOrReceivedSceneVersion from being set correctly.

I tried using batchUpdate but it only takes a single argument ( c5d2fc7127/packages/react-reconciler/src/ReactFiberWorkLoop.js (L1088) ) whereas the callback takes two.

Test Plan:
- Add a console.log before `this.broadcastScene("SCENE_UPDATE");` in App.tsx
- Connect a bunch of clients
- Have one move a shape
- Make sure that this client has the console logged
- Make sure the other clients don't have it
2020-03-28 21:25:40 -07:00
763735ac84 Add SCENE_INIT broadcast type for new user (#1095) 2020-03-28 19:35:56 -07:00
8e6d55cf75 Fix corner resize for multi-point arrows (#1105)
The logic to support it was not implemented. This is not the prettiest way to solve it in the world but it does work. Some more refactoring here is probably warranted.

Fixes #1039
2020-03-28 18:08:21 -07:00
24fa657093 Don't reset cache while zooming using a gesture (#1103)
* Don't reset cache while zooming using a gesture

This reuses the cached canvas while the gesture is happening. Once it has stop updating, then recompute the cache with the proper zoom.

This should massively improve performance when panning on big scenes on mobile

Fixes #1056

* update snapshot tests
2020-03-28 16:59:36 -07:00
95eaadeb85 Refactor paste code (#1102) 2020-03-28 15:43:09 -07:00
6056170d4b Fix wysiwyg center (#1101)
This wasn't taking into account zoom properly.

The logic should probably get refactored a bit, it's not ideal that we're passing canvas, state and scale as different arguments. Also it's weird that the function that returns the center is computing the viewport translation. But I'm not motivated enough to fix it right now...

Fixes #1100
2020-03-28 14:30:41 -07:00
aa54364bd6 Use existing helper to copy all state (#1098) 2020-03-27 15:18:14 -07:00
cac2dda5ac Add loading state (#1027)
* add loading state

* update snapshots

* add border radius

* fix comment breaking build jsx
2020-03-26 18:28:26 +01:00