94 Commits

Author SHA1 Message Date
Ed Bentley
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
fujimoto kyosuke
38c7d5a7bf
Reflect textAlign when pasting a style (#1378)
* Reflect `textAlign` when pasting a style

* Re-run Actions
2020-04-18 15:43:21 +01:00
Steven Nguyen
2bfb0c20c3
Add a button to show all content, if the zoom allows it. (#1406)
* add zoom center action button

* enhance zoom calculation and scroll to center

* add zoom out and center button

* filter deleted elements

* improve complexity

* add key shortcut

* calculate zoom value

* don't render zoomCenter action

* offset from top to account for shape menu

* change shortcut & add to shortcut dialog

* decrease offset

* revert offset

* change hotkey & description

* rename to zoomToFit

* change shortcut label & position

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-04-18 15:50:30 +02: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
Kostas Bariotis
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
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
Pete Hunt
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
Lipis
5b684495ef
Translate click and change label (#1299) 2020-04-07 16:40:37 +03:00
Kostas Bariotis
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
Lipis
0c3d34261e
Fixes in Shortcuts dialog and minor refactor (#1297) 2020-04-07 14:39:06 +03:00
Mohit kumar Bajoria
e4c154f43e
Button for shortcuts (#1253) 2020-04-07 13:42:10 +03:00
Kostas Bariotis
b60f5fcf06
Save on CTRL/CMD + S (#1287)
* save on shortcut

* revert keys files

* remove constant
2020-04-06 23:24:50 +01:00
Mohit kumar Bajoria
2de4fe29ad
Full Screen mode (#1212) 2020-04-06 00:47:13 +03:00
Daishi Kato
44f871de71
do not select deleted elements (#1215) 2020-04-04 12:27:34 +02:00
Kostas Bariotis
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
Sanghyeon Lee
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
Lipis
2a373571f8
Change order of the fill options (#1097) 2020-03-27 19:38:03 +02:00
David Luzar
6fd2a3b2e5
fix z-index action to account for deleted elems and add tests (#1077) 2020-03-26 00:28:50 -07:00
Faustino Kialungila
4442addc02
Type action names (#1079)
* Type action names

* improve typing

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-03-25 14:13:59 +01:00
dependabot-preview[bot]
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
David Luzar
82ce068972
fix history (#1009)
* fix history

* tweak withBatchedUpdates typing
2020-03-19 14:51:05 +01:00
David Luzar
b7da524538
confirm arrow on doubleclick (#949)
* confirm arrow on double click

* change hint

* fix cursor not updating on click
2020-03-18 16:43:06 +01:00
David Luzar
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
Faustino Kialungila
ae9b64a623
CMD + D to Duplicate Selection (#982)
* cmd+d to duplicate selection

* use duplicateElement instead

* use duplicateElement instead

* Update actionDuplicateSelection.ts

* select the new duplicated element

* add locale

* use event.key instead of event.code

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-03-16 22:53:02 +01:00
Pete Hunt
e1e2249f57
Abstract away or eliminate most of the mutation of the Elements array (#955) 2020-03-14 21:48:51 -07:00
Pete Hunt
3f8144ef85
Fix many syncing issues (#952) 2020-03-14 20:46:57 -07:00
David Luzar
450a024f5c
remove object.fromEntries (#933) 2020-03-13 15:10:24 +01:00
David Luzar
f0e6f4dbb8
Text esc fixes (#925)
* fix incorrectly resetting state on esc

* confirm text on esc
2020-03-12 18:04:56 +01:00
Pete Hunt
83a2f5de28
remove closures from mutateElement, get rid of the element spreading (#902) 2020-03-10 20:11:02 -07:00
idlewinn
1419f17175 enable version bumping for collaboration 2020-03-09 22:34:50 -07:00
Lipis
9de3716324
Update send/bring shortcuts and show them properly per operating… (#784)
* Show proper shortcuts

* sort

* Add shortcuts to bring/send

* fix hotkeys matching greedily

* Space

* align zindex shortcuts with figma

* switch to event.code & change Darwin shortcuts

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-03-09 14:06:35 +01:00
Pete Hunt
c89584832d
Reset selectedElementIds when deleting selected elements (#875) 2020-03-08 14:10:42 -07:00
Pete Hunt
ccbbdb75a6
Refactor ExcalidrawElement (#874)
* Get rid of isSelected, canvas, canvasZoom, canvasOffsetX and canvasOffsetY on ExcalidrawElement.

* Fix most unit tests. Fix cmd a. Fix alt drag

* Focus on paste

* shift select should include previously selected items

* Fix last test

* Move this.shape out of ExcalidrawElement and into a WeakMap
2020-03-08 10:20:55 -07:00
Jed Fox
8ecb4201db
How could I have gotten this so wrong? (#873) 2020-03-07 17:37:35 -08:00
Jed Fox
c6a0cfc2b1
Refactor (#862)
* Initial factoring out of parts of the LayerUI component

2360 → 2224 LOC

* Create a Section component

* Break up src/index.tsx

* Refactor actions to reduce duplication, fix CSS

Also consolidate icons

* Move scene/data.ts to its own directory

* Fix accidental reverts, banish further single-character variables

* ACTIVE_ELEM_COLOR → ACTIVE_ELEMENT_COLOR

* Further refactoring the icons file

* Log all errors

* Pointer Event polyfill to make the tests work

* add test hooks & fix tests

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-03-07 16:20:38 +01:00
Jed Fox
8e0206cc1e
Undo/Redo buttons, refactor menu toggles (#793)
* Make Undo & Redo and the menu buttons into actions; add undo/redo buttons

* Create variables for the ToolIcon colors

* Darken the menu buttons when they’re active

* Put the more intensive test in `perform`

* Fix & restyle hint viewer

* Add pinch zoom for macOS Safari

* Chrome/Firefox trackpad pinch zoom

* openedMenu → openMenu

* needsShapeEditor.ts → showSelectedShapeActions.ts

* Call showSelectedShapeActions
2020-03-01 20:39:03 +01:00
Lipis
097c5dfad7
Refactor: e -> event or error, err -> error, p -> pointer (#831)
* Refactor: e -> event or error, err -> error, p -> pointer

* simplify
2020-02-28 23:03:53 +01:00
Faustino Kialungila
1355e0201c
use a const for default font value (#834) 2020-02-24 16:29:54 +01:00
Faustino Kialungila
2131befd7a
Fix pasting styles on text elements (#833) 2020-02-24 15:35:56 +01:00
Faustino Kialungila
2ad0716f3d
fix style pasting (#832)
* fix style pasting

* Update src/actions/actionStyles.ts
2020-02-24 15:21:13 +01:00
Oren Me
07336bb168
feat: add reset zoom button (#777)
* feat: add reset zoom button

Add zoom reset button.
Button is shown only when zoom scale is different from 1

* change reset zoom icon

* always show zoom reset

* fix typo
2020-02-22 20:24:34 +01:00
lissitz
e80ab1c8a2
Don't render bounding box for multi-point lines during creation (#799)
* don't render bounding box for multi-point lines during creation

* force LayerUI rerender after creating a new point

Force LayerUI rerender after creating a new point so that the mobile UI
updates and the Done button is visible.

* don't select multiElement on confirm is locked

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-22 10:21:54 +01:00
Jed Fox
0fd3fb4b5b
More mobile tweaks (#790)
* Disable text selection

* Set content-editable=plaintext-only to disable Touch Bar formatting buttons

* Enlarge resize handle tap targets for pen/touch

* Make the lock button a button in mobile mode

* Use icons instead of Unicode characters; add an alternate toolbar for creating multipoint lines

* Allow buttons to hide themselves

* Fix heuristic for showing shape actions

* Refactor icons

* Fix label for edit button

* Switch edit button icon

* Remove lock button on mobile

* Add language selector on mobile

* Fix showing edit button on mobile

* Fix showing edit button on mobile, part 2

* Fix handle touch regions

* Fix scroll-back button position

* Allow using the text tool on a text object to start editing it

* Fix deletion of last point in line
2020-02-21 11:34:18 -08:00
Jed Fox
ab176937e6
Add touch support (#788)
* Add touch support

* Mock media query

* Mock media query pt 2

* Fix tests

* Allow installing as an app on iOS

* Fix type error

* Math.hypot

* delete and finalize buttons, hint viewer

* skip failing tests

* skip the rest of the failing tests

* Hide the selected shape actions when nothing is selected

* Don’t go into mobile view on short-but-wide viewports

* lol
2020-02-21 08:17:20 -05:00
Jed Fox
7a7a73b78d
Initial support for mobile devices (#787)
* Initial support for mobile devices

No editing yet, but UI looks nice and you can open the canvas menu

* Add support for editing shape color, etc

* Allow the mobile menus to cover the shape selector

* Hopefully fix test error

* Fix touch on canvas

* Fix safe area handling & remove unused Island
2020-02-20 15:44:38 -08:00
Enzo Ferey
6ebd41734f
Resize handler detection should not be active when moving multip… (#767)
* Fix bug.

* Implement `getSelectedElements`.

* Explicit condition.

* Respect variable naming.

* Keep state consistent.

* Use `isSomeElementSelected` abstraction.

* Missing ones.
2020-02-16 22:54:50 +01:00
Timur Khazamov
ad72946131
Shortcuts to zoom in/out and to reset zoom (#770)
* Shortcuts to zoom in/out and to reset zoom

* add support for numerical keys

* Fixed Firefox compatibility

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-16 17:00:45 +01:00
Timur Khazamov
eee961d65f
Use meta key + wheel to zoom in/out (#769) 2020-02-16 14:38:53 +01:00
Enzo Ferey
c7ff4c2ed6
Canvas zooming (#716)
* Zoom icons.

* Actions.

* Min zoom of 0 does not make sense.

* Zoom logic.

* Modify how zoom affects selection rendering.

* More precise scrollbar dimensions.

* Adjust elements visibility and scrollbars.

* Normalized canvas width and height.

* Apply zoom to resize test.

* [WIP] Zoom using canvas center as an origin.

* Undo zoom on `getScrollBars`.

* WIP: center zoom origin via scroll

* This was wrong for sure.

* Finish scaling using center as origin.

* Almost there.

* Scroll offset should be not part of zoom transforms.

* Better naming.

* Wheel movement should be the same no matter the zoom level.

* Panning movement should be the same no matter the zoom level.

* Fix elements pasting.

* Fix text WYSIWGT.

* Fix scrollbars and visibility.
2020-02-15 21:03:32 +01:00