Commit Graph

429 Commits

Author SHA1 Message Date
Faustino Kialungila 814299321e
Add missing locales for scrollBackToContent (#663)
* Add missing locales for scrollToContent

* remove duplicated locales
2020-02-02 14:29:09 +00:00
Faustino Kialungila 92deb033a3
Update logo (#665) 2020-02-02 12:06:19 +01:00
Christopher Chedeau f8a41cee16
Add keybindings for shapes (#648)
* Add keybindings for shapes

I'm not 100% sure about this one. I feel like it's going to help people be a lot more productive to display the key bindings at all time. But it also clutters the UI...

* increase font-size

* fix shape keybindings for non-qwerty keyboards

* tweak position and color

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 18:31:28 +01:00
Christopher Chedeau be97bd980e
Add button when scrolled outside of visible area (#643)
With the infinite scroll behavior, it's easy to scroll super far away from where the content is and have a hard time getting back. This PR adds a button to refocus on the center of the scene when no elements are visible anymore.
2020-02-01 17:52:10 +01:00
Faustino Kialungila 7c9e6dd3f1
support undo/redo for azerty keyboards (#630)
* support undo/redo for azerty keyboards

* migrate to event.key

* remove unnecessary shiftKey check

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 17:37:22 +01:00
Christopher Chedeau 46791e6da1
Add keybindings for color picker (#647)
* Add keybindings for color picker

This adds the ability to navigate using left/right/bottom/up keys and shows key bindings for all the different colors. This is only optimized for the qwerty keyboard layout, but unfortunately it's not possible to detect other keyboard layouts :(

* add aria-keyshortcuts and keybinding in title

* make focus select color, confirm on enter

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-02-01 13:56:15 +01:00
Gasim Gasimzada 1e4ce77612
Reintroduce multi-point arrows and add migration for it (#635)
* Revert "Revert "Feature: Multi Point Arrows (#338)" (#634)"

This reverts commit 3d2e59bfed.

* Convert old arrow spec to new one

* Remove unnecessary failchecks and fix context transform issue in retina displays

* Remove old points failcheck from getArrowAbsoluteBounds

* Remove all failchecks for old arrow

* remove the rest of unnecessary checks

* Set default values for the arrow during import

* Add translations

* fix restore using unmigrated elements for state computation

* don't use width/height when migrating from new arrow spec

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
2020-02-01 15:49:18 +04:00
Christopher Chedeau 4ff88ae03d
Fix caret for real! (#653)
Turns out the root cause was the outline. For some reason, doing "transparent" doesn't work but doing "1px solid transparent" does. Don't know why but I'll take it!
2020-02-01 06:07:08 +00:00
Christopher Chedeau 9a76556bea
Fixed wysiwyg carret disappearing on Chrome (#652)
There's a bug where the carret doesn't show up when the text is first focused on Chrome with the previous combination of CSS. I tweaked it and now it seems to work (don't ask me why!).

Unfortunately on Safari, ever since we moved to contentEditable on #274, the carret disappeared the first time. I unsuccessfully tried to repro in a smaller codebase ( https://jsfiddle.net/u2mjs90y/1/ ) but it does work in Safari...

I'm not exactly sure what's going on, there are bunch of issues opened against this bug when googling against all the browsers...
2020-02-01 05:54:33 +00:00
Christopher Chedeau 70db792549
Allow copy pasting inside of wysiwyg element (#651)
We did some hackery to prevent copy pasting when we didn't support multilines. But we do now so we can remove it.

Interestingly, newlines are actually <br /> elements. So we need to tweak the isInputLike logic a bit
2020-02-01 04:06:27 +00:00
Christopher Chedeau f261d6f2fc
Fix font preloading (#649)
Thanks to this stack overflow answer ( https://stackoverflow.com/a/41678350/232122 ) I was able to fix the font preloading!

If we put fonts.css in the public/folder and include it with normal html, we can avoid going through the build pipeline!
2020-02-01 04:06:03 +00:00
Christopher Chedeau e50dc5dbed
Fix wysiwyg text overflow (#650)
By using position: fixed like the rest of the UI components, it will no longer make the body change size and have bad side effects like scrolling.

Fixes #365
2020-02-01 04:05:53 +00:00
Christopher Chedeau 47f6328ae1
Fix ability to use arrow keys to navigate between shapes (#646)
This is the only way to navigate using the keyboard and was prevented by #596. Now it works fine.

Test Plan:
- Click on selection icon
- Use left/right arrow keys to move between tool icons, that works.

- Click on a shape, cmd+c
- Click on the selection icon
- Cmd+v, it pastes correctly
2020-02-01 02:58:16 +00:00
Christopher Chedeau 39674fe2b0
Add outline to button list (#644)
It's unclear otherwise when using the keyboard
2020-02-01 02:57:57 +00:00
Christopher Chedeau 29f1465b81
Fix wrong cursor for selection keyboard shortcut (#645)
Pressing 1 would change the cursor to a + instead of normal cursor
2020-02-01 02:57:44 +00:00
Christopher Chedeau c7eebd42c1
Fix conflict (#641) 2020-01-31 21:51:35 +00:00
Lipis fc341c3763
Better handling of 404 errors when loading from backend (#608) 2020-01-31 21:34:14 +00:00
Christopher Chedeau ead9aab888
Remove enzyme (#640)
The test that was added is not a good test. If we want to test things, we should be testing logic that is error prone such as all the mouse handling logic and state management. Adding a test for something trivial as displaying a list of data is just going to be annoying when we eventually change the UI and the test breaks.

Since this is the only test using enzyme, I also removed enzyme. We can add it back if we want to test a component using it.
2020-01-31 21:32:09 +00:00
Christopher Chedeau e4919e2e6c
Replace i18n by a custom implementation (#638)
There are two problems with the current localization strategy:
- We download the translations on-demand, which means that it does a serial roundtrip for nothing.
- withTranslation helper actually renders the app 3 times on startup, instead of once (I haven't tried to debug it)
2020-01-31 21:06:06 +00:00
Christopher Chedeau 637276301a
Different call of resumeRecording() (#636)
Instead of finding all the places where we want to resume recording, we should do it after every componentDidUpdate(). The idea is that we just want to disable the history for certain setState, for which we call directly before skipHistory.
2020-01-31 21:09:42 +01:00
David Luzar 3d2e59bfed
Revert "Feature: Multi Point Arrows (#338)" (#634)
This reverts commit 16263e942b.
2020-01-31 18:56:55 +01:00
Gasim Gasimzada 16263e942b
Feature: Multi Point Arrows (#338)
* Add points to arrow on double click

* Use line generator instead of path to generate line segments

* Switch color of the circle when it is on an existing point in the segment

* Check point against both ends of the line segment to find collinearity

* Keep drawing the arrow based on mouse position until shape is changed

* Always select the arrow when in multi element mode

* Use curves instead of lines when drawing arrow points

* Add basic collision detection with some debug points

* Use roughjs shape when performing hit testing

* Draw proper handler rectangles for arrows

* Add argument to renderScene in export

* Globally resize all points on the arrow when bounds are resized

* Hide handler rectangles if an arrow has no size

- Allow continuing adding arrows when selected element is deleted

* Add dragging functionality to arrows

* Add SHIFT functionality to two point arrows

- Fix arrow positions when scrolling
- Revert the element back to selection when not in multi select mode

* Clean app state for export (JSON)

* Set curve options manually instead of using global options

- For some reason, this fixed the flickering issue in all shapes when arrows are rendered

* Set proper options for the arrow

* Increaase accuracy of hit testing arrows

- Additionally, skip testing if point is outside the domain of arrow and each curve

* Calculate bounding box of arrow based on roughjs curves

- Remove domain check per curve

* Change bounding box threshold to 10 and remove unnecessary code

* Fix handler rectangles for 2 and multi point arrows

- Fix margins of handler rectangles when using arrows
- Show handler rectangles in endpoints of 2-point arrows

* Remove unnecessary values from app state for export

* Use `resetTransform` instead of "retranslating" canvas space after each element rendering

* Allow resizing 2-point arrows

- Fix position of one of the handler rectangles

* refactor variable initialization

* Refactored to extract out mult-point generation to the abstracted function

* prevent dragging on arrow creation if under threshold

* Finalize selection during multi element mode when ENTER or ESC is clicked

* Set dragging element to null when finalizing

* Remove pathSegmentCircle from code

* Check if element is any "non-value" instead of NULL

* Show two points on any two point arrow and fix visibility of arrows during scroll

* Resume recording when done with drawing

- When deleting a multi select element, revert back to selection element type

* Resize arrow starting points perfectly

* Fix direction of arrow resize based for NW

* Resume recording history when there is more than one arrow

* Set dragging element to NULL when element is not locked

* Blur active element when finalizing

* Disable undo/redo for multielement, editingelement, and resizing element

- Allow undoing parts of the arrow

* Disable element visibility for arrow

* Use points array for arrow bounds when bezier curve shape is not available

Co-authored-by: David Luzar <luzar.david@gmail.com>
Co-authored-by: Preet <833927+pshihn@users.noreply.github.com>
2020-01-31 18:16:33 +01:00
Lipis 9a17abcb34
Cleanup .gitignore (#629) 2020-01-31 13:55:53 +01:00
David Luzar 6886dfdea7
ensure we reset draggingElement when tool locked (#627) 2020-01-30 22:14:40 +01:00
Guillermo Peralta Scura 35750d8d09
Panning with space key (#579)
* Panning with space key

* prevent panning when selecting/dragging & add more checks

* Fix changing current tool via shortcut while panning

* Fix order of statements

* teardown on blur event

* Refactor cursor setting

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-30 17:08:59 -03:00
Robinson Marquez 4ad38e317e
485: Ability to switch to previously loaded ids in UI (#583) 2020-01-30 21:39:37 +02:00
David Luzar bd1c00014b
fix not resuming recording (#614) 2020-01-30 15:39:17 +01:00
David Luzar 023400c3cc
Revert "Fix keyboard shortcut (#587)" (#617)
This reverts commit cc3d71f13c.
2020-01-30 10:40:49 +01:00
Bakhtiiar Muzakparov cc3d71f13c
Fix keyboard shortcut (#587)
* Fix keyboard shortcut

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-29 16:31:49 +00:00
Bakhtiiar Muzakparov 63c685af73
Add russian translation (#612) 2020-01-29 14:00:47 +00:00
Lipis 82717bceda
Remove eslint-plugin-json-format (#609)
* Remove eslint-plugin-json-format

* json
2020-01-29 11:26:40 +01:00
Panayiotis Lipiridis 5418f68cc5 Update deps 2020-01-29 03:05:00 +02:00
Lipis 2dce2ce712
Show labels instead of icons for PNG, SVG (#606) 2020-01-29 02:30:02 +02:00
Lipis a9790c74f5
Wider export dialog (#603) 2020-01-29 02:26:02 +02:00
Lipis ba4fc0f1b3
Minor redesign of Export Dialog (#604) 2020-01-29 02:25:47 +02:00
Preet 97b11b0f53
SVG export (#598)
* first draft of export to SVG. WIP

* enabled text rendeing - which is not quite right atm

* placeholder svg icon

* size the canvas based on the bounding box of elements

* Do not add opacity attributes if default

* render background rect

* Ensure arrows are in the same SVG group

* parse font-size from font

* export web fonts

* use fixed locations for fonts

* Rename export functions

* renamed export file

* oops broke the icon.
2020-01-28 12:25:13 -08:00
Lipis 321e4022b0
Add headers for Netlify (#602) 2020-01-28 21:15:24 +02:00
lissitz 845484aecc Fix: refreshing the page while selecting saves the selection ele… (#601)
* Fix: refreshing the page while selecting saves the selection element

Fixes #591.

* fix lint

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-28 16:44:34 +01:00
David Luzar 26048ee469
improve clipboard handling (#596)
* improve clipboard handling

* fix regression of not defocusing tool icons
2020-01-27 22:14:35 +01:00
Faustino Kialungila de68561df5
lowercase pasted color (#594)
* lowercase pasted color

* remove unused class & don't lowercase input

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-27 19:51:11 +01:00
David Luzar 187cfbe2d8
temp hack fix for state updates (#593)
* temp hack fix state updates

* switch setTimeout for state mutation
2020-01-27 19:24:11 +01:00
Thomas Steiner a862d12ac1
Bump browser-nativefs version to v0.2.0 (#586)
* Bump browser-nativefs version to v0.2.0

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

* Update package-lock.json
2020-01-27 10:14:44 +01:00
Guillermo Peralta Scura 2363afa864
Fix Spanish translation (#585) 2020-01-26 17:27:17 -03:00
Guillermo Peralta Scura 67eca2bda1
Add landmarks (#564)
Use HTML semantic elements to set the landmarks of the page.

This is helpful for assistive technologies to determine the different regions of content. In our case it's useful for jumping between the different islands that we use to group the form controls.
2020-01-26 17:14:31 -03:00
Lipis fc350f2ecd Adjust language selector (#552)
* Adjust language selector

* rem
2020-01-26 21:04:56 +01:00
Lipis 81d169e90c Add tool tip for shape lock (#551)
* Add tool tip for shape lock

* tweak label & fix master rebase

Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-01-26 21:00:00 +01:00
David Luzar 61264ee2d6
move title to label (#584) 2020-01-26 20:49:18 +01:00
David Luzar e17f743df1 change cartoonist roughness (#582) 2020-01-26 19:16:33 +00:00
David Luzar 7b842fc330 simplify distance helper and factor out common bounds helper (#581)
* simplify distance helper

* factor out common bounds helper
2020-01-26 19:15:08 +00:00
Christopher Chedeau 5853fba821
Fix global settings (#572)
Some PR made the settings UI show up even though nothing is selected. However, you couldn't actually change any of those settings except for the colors. This PR pipes through the rest of the properties so everything works now!
2020-01-26 19:09:11 +00:00