593 Commits

Author SHA1 Message Date
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
Lipis
949c3841ea
Show hint under toolbar (#783) 2020-02-21 17:04:54 +01:00
İsmail Namdar
626c99939e
add tr localization (#789) 2020-02-21 16:14:06 +01: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
Lipis
c2855e2cb8
Add new favicon (#786) 2020-02-21 10:39:09 +01: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
David Luzar
9439908b92
use a better cloning algorithm (#753)
* use a better cloning algorithm

* Revert "use a better cloning algorithm"

This reverts commit 7279262129d665ffa92f016802155c1db7c35b7f.

* implement custom cloning algorithm

* add tests

* refactor

* don't copy canvas & ignore canvas in related ops

* fix tests
2020-02-19 22:28:11 +01:00
Christopher Chedeau
5256096d76
Fast & Furious (#655)
* [WIP] Fast & Furious

* ensure we translate before scaling

* implement canvas caching for rest of elements

* remove unnecessary ts-ignore

* fix for devicePixelRatio

* initialize missing element props on restore

* factor out canvas padding

* remove unnecessary filtering

* simplify renderElement

* regenerate canvas on prop changes

* revert swapping shape resetting with canvas

* fix blurry rendering

* apply devicePixelRatio when clearing canvas

* improve blurriness; fix arrow canvas offset

* revert canvas clearing changes in anticipation of merge

* normalize scrollX/Y on update

* fix getDerivedStateFromProps

* swap derivedState for type brands

* tweak types

* remove renderScene offsets

* move selection element translations to renderElement

* dry out canvas zoom transformations

* fix padding offset

* Render cached canvas based on the zoom level

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Preet <833927+pshihn@users.noreply.github.com>
2020-02-19 17:25:01 +01:00
dependabot-preview[bot]
d39c7d4421
Bump react-scripts from 3.3.1 to 3.4.0 (#773)
Bumps [react-scripts](https://github.com/facebook/create-react-app/tree/HEAD/packages/react-scripts) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/facebook/create-react-app/releases)
- [Changelog](https://github.com/facebook/create-react-app/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/create-react-app/commits/react-scripts@3.4.0/packages/react-scripts)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-17 11:39:58 +01:00
Sosuke Suzuki
2bb95f0651
Modify to avoid to blur while composing (#775) 2020-02-17 09:44:08 +01:00
dependabot-preview[bot]
c4dbb7ca45
Bump husky from 4.2.2 to 4.2.3 (#774)
Bumps [husky](https://github.com/typicode/husky) from 4.2.2 to 4.2.3.
- [Release notes](https://github.com/typicode/husky/releases)
- [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
- [Commits](https://github.com/typicode/husky/compare/v4.2.2...v4.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-17 09:42:39 +01: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
David Luzar
2d22ffda49
fix wheel zoom step (#771) 2020-02-16 16:23:56 +01:00
Timur Khazamov
eee961d65f
Use meta key + wheel to zoom in/out (#769) 2020-02-16 14:38:53 +01:00
Szymon Pajka
360864ef3d
Add missing Polish translations (#766) 2020-02-15 15:32:20 -08: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
Christopher Chedeau
dd2d7e1a88
Updates on the font (#764)
* Updates on the font

See discussion in #747

Fixes #747

* another update
2020-02-14 08:21:00 -08:00
Thomas Steiner
98c2b26118
Update browser-nativefs dep after repo move (#763)
* Update browser-nativefs dep after repo move

* Bump deps
2020-02-12 10:19:59 +01:00
rubjo
40b54a8780
Update translation: Norwegian Bokmål (#762) 2020-02-12 10:19:19 +01:00
Gasim Gasimzada
7183234895
Write integration tests (#719)
* Scaffold a simple test case for debugging

* Set up Jest environment that works with React

- Install and set up react-testing-library
- "Unignore" roughjs and browser-nativejs transformations
- Separate App component from ReactDOM

* Write first passing test

- Mock canvas
- Remove App file and mount/unmount ReactDOM on import

* Add tests for drag create behavior

* Fix comments in dragCreate

* Pin jest-mock-canvas dependency

* Remove dependency range for testing library

* Add tests for multi point mode and selection element

* Fix all tests due to decrease in updates to canvas when changing tools

* Disable state updates if component is unmounted

- Remove all event listeners
- Disable storing scene in state if component is unmounted

* Add tests for move and element selection

* Merge branch 'master' into add-integration-tests

* Add tests for resizing rectangle

* move unmounted check to syncActionResult method

* Use a custom test renderer instead of default testing-library functions

* Add custom query for selecting tools

* move files around

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-11 23:19:43 +01:00
Gasim Gasimzada
ad4ad238ef
Remove invisibly small elements on scene load (#754) 2020-02-10 15:38:41 +01:00
lissitz
fa12125db0
fix some element types reset to selection when the lock is active (#746)
* keep arrows and lines selected if locked

* keep element type selected if locked after inserting text

* ensure clicking outside doesn't create new text

* esc should switch to selection even if locked

* reset cursor when creating text via doubleClick

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-10 15:09:50 +01:00
dependabot-preview[bot]
1ec3946ed6 Bump @types/jest from 25.1.1 to 25.1.2 (#750)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 25.1.1 to 25.1.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-10 09:50:57 +01:00
David Luzar
6dd3620dd6 fix cloning element.points (#744) 2020-02-09 23:57:14 +01:00
Christopher Chedeau
b64fe9aae4
Update FG_Virgil to support Russian and Greek characters (#720)
* Update FG_Virgil to support Russian and Greek characters

Fixes #469

* more symbols
2020-02-09 14:51:47 -08:00
David Luzar
2a472bb912
ensure duplicateElement does deep copy of points (#742) 2020-02-09 14:45:21 -08:00
David Luzar
389e40900c
z-index button fixes (#738)
* fix svg attributes

* center z-index icons

* remove unnecessary attributes

* differentiate button :active bg

* prevent selection of ToolIcon hints

* emphasize active elem color
2020-02-09 17:09:21 +01:00
wboucher
471ea4a747
Add zindex to panel (#736)
* Add z-index options back to panel

* Add formatting for z-index panel buttons

* make z-index buttons all the same width

* make z-index button spacing even

* use svg icons & translations

* add ui legend

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-09 15:07:34 +01:00
Gasim Gasimzada
b09373acf7
Align arrow caps based on bezier curve instead of stored points (#737) 2020-02-09 14:23:09 +01:00
Christopher Chedeau
c2a3b67ccc
Fix scrollbar (#735)
The computation was not correct. I'm not really sure how it used to work but it was not taking into account the dimensions of the scene so it was wrong.

The new algorithm is computing the scrollbar such that it's the position of the viewport in relationship to the bounding box of the viewport and all the elements.

Fixes #680
2020-02-08 16:20:14 -08:00
Christopher Chedeau
935a7f58a7
Remove previously loaded scenes (#734)
As mentioned in #724, the current implementation is suboptimal. Let's remove it until we come back with a better design.

Fixes #724
2020-02-08 15:05:38 -08:00
Christopher Chedeau
8d64ec8153
Add lock icon (#733)
Because it looks more secure ;)
2020-02-08 14:53:16 -08:00
Christopher Chedeau
e6d03aeeea
End to end encryption description (#731)
* End to end encryption description

This PR updates the url upload description to mention that it is end to end encrypted. I used a very similar message as whatsapp so that it is familar to people.

I also removed the automatic copying and turned the alert into prompt. This should be less awkward than the current implementation.

* capitalize excalidraw

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-08 10:43:59 +01:00
Szymon Pajka
f359a1ea1b
Fix grammar problems in Polish translation 🇵🇱🐛 (#730)
* corrected typos
* fixed grammar
2020-02-07 23:48:39 +01:00
David Luzar
d79293de06
move footer into layerUI & refactor ActionManager (#729) 2020-02-07 23:46:19 +01:00
David Luzar
88eacc9da7
Improve pasting (#723)
* switch to selection tool on paste

* align pasting via contextMenu with pasting from event

* ensure only plaintext can be pasted

* fix findShapeByKey regression

* simplify wysiwyg pasting

* improve wysiwyg blurriness
2020-02-07 18:42:24 +01:00
Lipis
ba1a39c9f3
Add npmrc to have pinned deps (#727) 2020-02-07 13:59:23 +01:00
Szymon Pajka
1cd0dfe922
Add Polish language support (#725) 2020-02-07 12:37:33 +01:00
BM
a7dc067dfe
Fix language selection (#726) 2020-02-07 10:43:30 +00:00
David Luzar
3b20e6e2b8
fix decoding imported data from backend (#722) 2020-02-06 18:46:26 +01:00
Gasim Gasimzada
33016bf6bf
Fix issues related to history (#701)
* Separate UI from Canvas

* Explicitly define history recording

* ActionManager: Set syncActionState during construction instead of in every call

* Add commit to history flag to necessary actions

* Disable undoing during multiElement

* Write custom equality function for UI component to render it only when specific props and elements change

* Remove stale comments about history skipping

* Stop undo/redoing when in resizing element mode

* wip

* correctly reset resizingElement & add undo check

* Separate selection element from the rest of the array and stop redrawing the UI when dragging the selection

* Remove selectionElement from local storage

* Remove unnecessary readonly type casting in actionFinalize

* Fix undo / redo for multi points

* Fix an issue that did not update history when elements were locked

* Disable committing to history for noops

- deleteSelected without deleting anything
- Basic selection

* Use generateEntry only inside history and pass elements and appstate to history

* Update component after every history resume

* Remove last item from the history only if in multi mode

* Resume recording when element type is not selection

* ensure we prevent hotkeys only on writable elements

* Remove selection clearing from history

* Remove one point arrows as they are invisibly small

* Remove shape of elements from local storage

* Fix removing invisible element from the array

* add missing history resuming cases & simplify slice

* fix lint

* don't regenerate elements if no elements deselected

* regenerate elements array on selection

* reset state.selectionElement unconditionally

* Use getter instead of passing appState and scene data through functions to actions

* fix import

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-05 19:47:10 +01:00
David Luzar
972d69da6c
fix hotkeys not working when non-writable input focused (#717) 2020-02-05 19:07:53 +01:00
David Luzar
82eb97462b
fix restoring from localStorage (#715) 2020-02-05 17:57:08 +01:00
David Luzar
b7a6ceba68
Eslint tweaks (#696)
* make eslint styleguide into warnings & drop no-else-return

* reintroduce max-warnings=0

* remove unnecessary eslint line disable

* reintroduce no-else-return rule
2020-02-05 17:41:14 +01:00
Christopher Chedeau
2dd1796351
Add encryption (#642)
* Add encryption

In order to avoid the server being able to read the content of the scene, this PR implements local encryption and decryption. This implements the algorithm described in #610.

Right now the server doesn't support uploading binary files. I mocked the server with comments. @lipis, could you add support on the server and update this PR? I added a bunch of TODO: that tell you where to comment/uncomment in order to get the server flow going.

To test locally right now:
- Import: Open http://localhost:3000/#json=1234,5oYVOnGpWYPPTz19-PMYYw and see a square
- Export: Click the export link and see the right url with the private key + the encrypted binary in the console

Fixes #610

* backend_v2

* v2
2020-02-05 07:35:51 -08:00
Gasim Gasimzada
c7d7d65e1b
Set arrow cap size based on minimum the full length of the arrow instead of last segment (#709) 2020-02-05 03:54:17 -08:00
BM
27a1217981
Remove select color input on click (#708) 2020-02-05 04:04:29 +00:00
Lipis
e79d9f5676
Add white background to og-image (#702) 2020-02-04 17:55:50 +01:00
Gasim Gasimzada
08d80fb4fe
Add points to multi arrows in real time (#697)
* Add points to multi arrows in real time

* Fix linter issues

* Clear unecessary values from local storage
2020-02-04 14:39:08 +01:00