Commit Graph

394 Commits

Author SHA1 Message Date
9351b2821c feat: add width, height as props to App.tsx (#1871) 2020-07-07 17:10:39 +02:00
cd87bd6901 do not center text when not applicable (#1783) 2020-06-25 21:21:27 +02:00
baa8fb6c14 grid support (1st iteration) (#1788)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-06-23 17:24:52 +02:00
53ab46126d support resizing multiple elements including texts (#1726)
Co-authored-by: David Luzar <luzar.david@gmail.com>
2020-06-08 11:25:20 +02:00
d1be2a5481 fix text constructor groupIds & improve type safety (#1715) 2020-06-06 13:32:43 +02:00
476c0e9f8a Fix undo with line editing (#1717) 2020-06-05 17:11:24 +02:00
14a66956d7 Implement line editing (#1616)
* implement line editing

* line editing with rotation

* ensure adding new points is disabled on point dragging

* fix hotkey replacement

* don't paint bounding box when creating new multipoint

* tweak points style, account for zoom and z-index

* don't persist editingLinearElement to localStorage

* don't mutate on noop points updates

* account for rotation when adding new point

* ensure clicking on points doesn't deselect element

* tweak history handling around editingline element

* update snapshots

* refactor pointerMove handling

* factor out point dragging

* factor out pointerDown

* improve positioning with rotation

* revert to use roughjs for calculating points bounds

* migrate from storing editingLinearElement.element to id

* make GlobalScene.getElement into O(1)

* use Alt for adding new points

* fix adding and deleting a point with rotation

* disable resize handlers & bounding box on line edit

Co-authored-by: daishi <daishi@axlight.com>
2020-06-01 11:35:44 +02:00
f413bab3de Fix group element removing (#1676) 2020-05-30 13:48:57 -07:00
fa359034c5 scroll the closest element to center (#1670)
Co-authored-by: Sanghyeon Lee <yongdamsh@gmail.com>
2020-05-30 14:02:32 +02:00
44a88d2d58 Rewrite restore to guard against missing migrations (#1664) 2020-05-28 02:41:34 -07:00
56f8bc092d Tests for groups, more test utils (#1669) 2020-05-28 10:56:18 +02:00
4f3bf79708 skip element mutation on noop updates (#1667) 2020-05-28 00:50:56 -07:00
7edcea9a93 feat: resize text element (#1650)
* feat: resize text element

* ignore small font size change that leads jankiness

Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-28 07:17:15 +09:00
63c10743fb split font into fontSize and fontFamily (#1635) 2020-05-27 15:14:50 +02:00
61e5b66dac Group/ungroup (#1648)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-26 13:07:46 -07:00
35049e3de7 History tweaks (#1641)
Co-authored-by: Pete Hunt <phunt@twitter.com>
2020-05-24 15:17:14 -07:00
d315e3dc4d Update TypeScript to 3.9.3 (#1640)
Co-authored-by: tk338g <tkhazamov@wayfair.com>
2020-05-24 21:17:25 +02:00
6512ede9ca Optimize undo history (#1632)
Co-authored-by: dwelle <luzar.david@gmail.com>
2020-05-23 12:07:11 -07:00
51608c07b0 15-degree rotation locking (#1627) 2020-05-23 10:45:05 +02:00
584e4182a7 Ensure arrows are not draggable from inside (#1620) 2020-05-21 21:57:54 +02:00
c427aa3cce Prefer arrow functions and callbacks (#1210) 2020-05-20 15:21:37 +02:00
4d2e8f9ad1 feat: resize multiple elements including two-point lines (#1607) 2020-05-18 10:36:30 +02:00
6b628bb1a6 fix: resize non solid lines/arrows/draws (#1608) 2020-05-17 16:01:35 +02:00
39c56a4c01 implement stroke style (#1571) 2020-05-14 17:04:33 +02:00
f6be200388 feat: resize multiple curved lines (#1596) 2020-05-14 16:56:14 +02:00
9ec43d2626 Add free draw mode (#1570) 2020-05-12 21:10:11 +02:00
394237728f Refactor: resize two-point lines/arrows (#1568) 2020-05-10 17:41:36 +02:00
3b1d6910aa fix resizing: dynamic pointer offset for better UX (#1560) 2020-05-09 10:57:00 +02:00
73d8c5b7c1 fix resizing lines with abs coords bigger than element w/h (#1427) 2020-05-04 17:25:40 +02:00
da1031aeb4 Fix resize logic (partly) (#1475) 2020-04-27 10:30:19 +02:00
ed6fb60337 resize elements from center point (#1225)
* add hint & support multi-line hints

* resize from center point using the new resize maths

* resize with origin element when lifting alt key

* add readonly to elementOriginPosition

* add setResizeWithCenterKeyLifted

* isResizeFromCenter logic

* offsetX and offsetY

* simplify equations

* creating element from center point

* lint

* lint

* lint

* remove revert on key up logic

Co-authored-by: dwelle <luzar.david@gmail.com>
Co-authored-by: daishi <daishi@axlight.com>
2020-04-22 17:57:17 +02:00
8c49770e3b Better resize cursors on rotated elements (#1470)
* better resize cursor on rotated elements

* refactor with Math.round
2020-04-22 15:11:01 +02:00
9ac79061fa Bump roughjs and resolve breaking change in roughjs refactoring… (#1463)
* Fix for roughjs refactoring curve-estinmation code into a separate package

* Update jest transformIgnorePatterns
2020-04-20 19:43:06 +02:00
7df16c1b1d Bump prettier from 2.0.3 to 2.0.4 (#1412)
* Bump prettier from 2.0.3 to 2.0.4

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

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-14 12:30:58 +03:00
e77e2255bd Add test for getElementBounds (#1395)
* fix calc diamond bounds

* Add test for getElementBounds

* use toEqual
2020-04-13 17:47:09 -07:00
692ceece65 fix not using className when querying container (#1420) 2020-04-13 17:29:11 +02:00
6771b505ad rewrite wysiwyg property updating (#1387)
* rewrite wysiwyg property updating

* reuse existing class

* fix case of focus being stolen by other UIs

* revert mistake csp removal

* ensure we don't run cleanup twice

* fix opacity updating

* add shape actions menu class to constants
2020-04-12 15:57:57 +02:00
038cff8793 fix calc diamond bounds (#1394) 2020-04-11 18:19:01 -07:00
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
5ca763cdbb Calculate rotated element bounds properly (#1354)
* Calculate rotated element bounds properly, fixes #1303

* prefer isLinearElement

* empty commit
2020-04-11 13:10:47 +02:00
9761d7ea50 Refactor ResizeArrowFnType to resolve Codesandbox parsing error (#1338) 2020-04-09 19:10:35 +03:00
8efe0b7d05 Shift loses pointer fixing #1296 (#1330)
* change resize math to absolute instead of delta

* typings

* small change for width on rotation

* apply absolute resize to other sides

* revert&change math.ts

* polish, polish, polish

* refactor with offset

* eliminate nextX

* rename to offsetPointer

* fix curved lines

* prefer arrow function

* remove unused variables/comments for now

Co-authored-by: daishi <daishi@axlight.com>
2020-04-10 00:14:32 +09:00
b1ed5b4cdc Support negative resize for multiple points line/arrow (#1237)
* Support negative resize for multiple points line

* prettier

* Fix an issue with width or height becoming zero
2020-04-09 11:53:12 +02:00
57bbc9fe55 Fill a looped curve with the selected background color (#1315) 2020-04-09 11:46:47 +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
3fd6f3023f support newline on shift+enter (#1324) 2020-04-08 20:56:27 +02: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
c3b83fba38 fix detecting rotated elements with selection (#1273)
* fix #1232

* Update src/element/bounds.ts

* prefer arrow functions

* fix merging

Co-authored-by: Lipis <lipiridis@gmail.com>
2020-04-07 16:04:20 +02: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