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
2020-01-24 12:04:54 +02:00
2020-01-31 18:16:33 +01:00
2020-01-22 15:13:00 +01:00
2020-01-31 13:55:53 +01:00
2020-01-24 12:04:54 +02:00
2020-01-05 13:09:29 -08:00
2020-01-25 15:30:01 +01:00
2020-01-02 11:03:48 -08:00

Excalidraw logo: Sketch handrawn like diagrams.

Excalidraw is a whiteboard tool that lets you easily sketch diagrams that have a hand-drawn feel to them.

Follow Excalidraw on Twitter

Try it now

Netlify Status

Go to https://excalidraw.com to start sketching

Testimonials

Run the code

Code Sandbox

  • Go to https://codesandbox.io/s/github/excalidraw/excalidraw
  • You can start coding instantly, and even send PRs from there!

Local Installation

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Clone the repo

git clone https://github.com/excalidraw/excalidraw.git

Commands

Command Description
npm install Install the dependencies
npm run start Run the project
npm run fix Reformat all files with Prettier
npm run test:code Test for formatting with Prettier
npm run test:app Test the app
npm run test Run all tests

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

You can also discuss the app on our Gitter channel.

Excalidraw is built using these awesome tools

And the main source of inspiration for starting the project is the awesome Zwibbler app.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Description
No description provided
Readme 44 MiB
Languages
TypeScript 89.6%
SCSS 4.2%
MDX 3.5%
JavaScript 2.4%
HTML 0.2%