1803 Commits

Author SHA1 Message Date
Lipis
1a6431a04a
New Crowdin Translations (#845)
* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Simplified)

* Update i18n.ts

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (German)

* New translations en.json (Norwegian)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Russian)

* New translations en.json (Spanish)

* New translations en.json (Turkish)

* New translations en.json (Chinese Simplified)

* New translations en.json (French)

* New translations en.json (French)

* New translations en.json (Indonesian)

* Update i18n.ts

* Update i18n.ts

* New translations en.json (French)
2020-03-07 01:01:01 +02:00
lissitz
e920c078b9
Improve scrollbar-mouse interaction (#667)
* fix scrollbar detection on high devicePixelRatio devices

* don't create a new element on pointerdown over a scrollbar

* Return scrollbars from renderScene and use it in isOverScrollBars

* remove unneeded setState

* show default cursor when hovering or dragging a scrollbar

* disable scrollbars when in multielement mode

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-03-01 21:43:35 +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
0ee33fe341
Change the extension to .excalidraw (#858)
* Change the extension to .excalidra

* Support opening as well

* support .excalidraw extension on canvas  DranAndDrop

Co-authored-by: Faustino Kialungila <Faustino.kialungila@gmail.com>
2020-02-29 18:42:26 +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
Lipis
759df14143
Revert "Use direct URL for the backend (#846)" (#852)
This reverts commit 602f32b7430b7e3870934954da8549f33a31cd86.
2020-02-28 08:39:26 -08:00
Lipis
602f32b743
Use direct URL for the backend (#846) 2020-02-28 13:12:34 +01:00
David Luzar
7e0e885417
ensure restored elements are normalized before filter (#844) 2020-02-27 17:37:43 +01:00
Lipis
a8a5733e50
New translations en.json (French) (#841) 2020-02-25 12:41:44 +01:00
Lipis
718713672a
New translations en.json (Portuguese) (#840) 2020-02-25 10:09:38 +01:00
Lipis
26ce7fc563
New Crowdin translations (#838) 2020-02-24 22:46:49 +01:00
David Luzar
8198d71af8
fix svg export (#837) 2020-02-24 21:08:13 +01:00
David Luzar
4977593ec4
fix exporting lines as svg (#836) 2020-02-24 18:30:21 +01:00
Lipis
19e746792e
New Crowdin translations (#829) 2020-02-24 17:34:54 +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
David Luzar
4b8b9965c2
fix early return from renderScene (#815) 2020-02-23 21:19:27 +01:00
Lipis
4e3a2f9e3b
New Crowdin translations (#813)
* New translations en.json (German)

* New translations en.json (German)

* New translations en.json (German)
2020-02-23 16:50:45 +01:00
Lipis
165ce17590
New Crowdin translations (#811)
* New translations en.json (French)

* New translations en.json (German)

* New translations en.json (Norwegian)

* New translations en.json (Polish)

* New translations en.json (Portuguese)

* New translations en.json (Russian)

* New translations en.json (Spanish)

* New translations en.json (Turkish)

* New translations en.json (Polish)
2020-02-23 11:31:49 +01:00
David Luzar
80a49e9611
improve error handling & map stack trace (#809)
* improve error handling & map stack trace

* log error message and tweak

* support logging multiple errors

* move dynamic import inside try/catch
2020-02-22 22:37:04 +01:00
Takumi
a613d02147
Add cursor pointer style to hidden radio buttons (#810)
* Add cursor pointer style to hidden radio buttons

* ensure hidden input buttons don't interact with mouse

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-22 20:26:06 +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
Jed Fox
74add8661a
Fix error on export (#808) 2020-02-22 07:46:12 -08:00
Jed Fox
4e489bfb6d
Fix zoom being set to NaN (#807)
* Fix zoom being set to NaN

* recover zoom default value on restore if invalid

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-22 14:37:04 +01:00
Lipis
d342cae2ae
New Crowdin translations (#806)
* New translations en.json (Polish)

* New translations en.json (Polish)
2020-02-22 13:40:46 +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
43236bed68
Fix error with contentEditable (#803) 2020-02-21 19:51:34 -08:00
Lipis
09fa56335e
New Crowdin translations (#796) 2020-02-21 23:56:06 +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
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
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
Sosuke Suzuki
2bb95f0651
Modify to avoid to blur while composing (#775) 2020-02-17 09:44:08 +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
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
David Luzar
6dd3620dd6 fix cloning element.points (#744) 2020-02-09 23:57:14 +01: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