excalidraw/packages/excalidraw
Ryan Di bbdcd30a73
refactor: update collision from ga to vector geometry (#7636)
* new collision api

* isPointOnShape

* removed redundant code

* new collision methods in app

* curve shape takes starting point

* clean up geometry

* curve rotation

* freedraw

* inside curve

* improve ellipse inside check

* ellipse distance func

* curve inside

* include frame name bounds

* replace previous private methods for getting elements at x,y

* arrow bound text hit detection

* keep iframes on top

* remove dependence on old collision methods from app

* remove old collision functions

* move some hit functions outside of app

* code refactor

* type

* text collision from inside

* fix context menu test

* highest z-index collision

* fix 1px away binding test

* strictly less

* remove unused imports

* lint

* 'ignore' resize flipping test

* more lint fix

* skip 'flips while resizing' test

* more test

* fix merge errors

* fix selection in resize test

* added a bit more comment

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
2024-04-04 16:31:23 +08:00
..
actions refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
components refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
context build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
css feat: expose more collaborator status icons (#7777) 2024-03-18 10:20:07 +01:00
data feat: load old library if migration fails 2024-03-11 09:57:01 +01:00
element refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
hooks feat: command palette (#7804) 2024-03-28 16:16:32 +00:00
locales feat: show firefox-compatible command palette shortcut alias (#7825) 2024-03-28 18:12:54 +01:00
renderer refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
scene feat: expose more collaborator status icons (#7777) 2024-03-18 10:20:07 +01:00
tests refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
.gitignore docs: add next js with app router example (#7552) 2024-01-24 17:07:54 +05:30
.size-limit.json build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
align.ts fix: make getBoundTextElement and related helpers pure (#7601) 2024-01-26 11:29:07 +05:30
analytics.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
animated-trail.ts feat: add eraser tool trail (#7511) 2024-01-11 16:10:15 +00:00
animation-frame-handler.ts feat: add eraser tool trail (#7511) 2024-01-11 16:10:15 +00:00
appState.ts fix: remove t from getDefaultAppState and allow name to be nullable (#7666) 2024-02-15 11:11:18 +05:30
CHANGELOG.md feat: store library to IndexedDB & support storage adapters (#7655) 2024-03-08 22:29:19 +01:00
charts.test.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
charts.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
clients.ts feat: expose more collaborator status icons (#7777) 2024-03-18 10:20:07 +01:00
clipboard.test.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
clipboard.ts fix: remove dependency of t from clipboard and image (#7712) 2024-02-21 19:45:33 +05:30
colors.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
constants.ts feat: support to not render remote cursor & username (#7130) 2024-03-18 10:41:06 +01:00
css.d.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
cursor.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
deburr.ts feat: command palette (#7804) 2024-03-28 16:16:32 +00:00
distribute.ts fix: make getBoundTextElement and related helpers pure (#7601) 2024-01-26 11:29:07 +05:30
emitter.ts feat: support pen erasing (#7496) 2024-01-01 13:27:03 +01:00
env.cjs build: Welcome ESM and Bye Bye UMD (#7441) 2024-01-01 20:18:44 +05:30
errors.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
frame.test.tsx build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
frame.ts fix: export utils from excalidraw package in excalidraw library (#7731) 2024-02-28 11:14:57 +05:30
ga.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
gadirections.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
galines.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
gapoints.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
gatransforms.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
gesture.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
global.d.ts refactor: editor events sub/unsub refactor (#7483) 2023-12-30 11:12:38 +01:00
groups.ts fix: make getBoundTextElement and related helpers pure (#7601) 2024-01-26 11:29:07 +05:30
history.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
i18n.ts build: Welcome ESM and Bye Bye UMD (#7441) 2024-01-01 20:18:44 +05:30
index-node.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
index.tsx feat: support to not render remote cursor & username (#7130) 2024-03-18 10:41:06 +01:00
jotai.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
keys.ts feat: command palette (#7804) 2024-03-28 16:16:32 +00:00
laser-trails.ts feat: support to not render remote cursor & username (#7130) 2024-03-18 10:41:06 +01:00
math.test.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
math.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
package.json feat: command palette (#7804) 2024-03-28 16:16:32 +00:00
points.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
polyfill.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
pwacompat.d.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
queue.test.ts feat: store library to IndexedDB & support storage adapters (#7655) 2024-03-08 22:29:19 +01:00
queue.ts feat: store library to IndexedDB & support storage adapters (#7655) 2024-03-08 22:29:19 +01:00
random.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
react-app-env.d.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
reactUtils.ts fix: decouple react and react-dom imports from utils and make it treeshakeable (#7527) 2024-01-08 21:01:47 +05:30
README.md build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
shapes.tsx build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
snapping.ts fix: make bounds independent of scene (#7679) 2024-02-19 19:39:14 +05:30
tsconfig.json docs: add next js with app router example (#7552) 2024-01-24 17:07:54 +05:30
types.ts refactor: update collision from ga to vector geometry (#7636) 2024-04-04 16:31:23 +08:00
utility-types.ts feat: store library to IndexedDB & support storage adapters (#7655) 2024-03-08 22:29:19 +01:00
utils.ts feat: expose more collaborator status icons (#7777) 2024-03-18 10:20:07 +01:00
vite-env.d.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30
zindex.ts build: decouple package deps and introduce yarn workspaces (#7415) 2023-12-12 11:32:51 +05:30

Excalidraw

Excalidraw is exported as a component to directly embed in your projects.

Installation

You can use npm

npm install react react-dom @excalidraw/excalidraw

or via yarn

yarn add react react-dom @excalidraw/excalidraw

After installation you will see a folder excalidraw-assets and excalidraw-assets-dev in dist directory which contains the assets needed for this app in prod and dev mode respectively.

Move the folder excalidraw-assets and excalidraw-assets-dev to the path where your assets are served.

By default it will try to load the files from https://unpkg.com/@excalidraw/excalidraw/dist/

If you want to load assets from a different path you can set a variable window.EXCALIDRAW_ASSET_PATH depending on environment (for example if you have different URL's for dev and prod) to the url from where you want to load the assets.

Note

If you don't want to wait for the next stable release and try out the unreleased changes you can use @excalidraw/excalidraw@next.

Dimensions of Excalidraw

Excalidraw takes 100% of width and height of the containing block so make sure the container in which you render Excalidraw has non zero dimensions.

Demo

Try here.

Integration

Head over to the docs

API

Head over to the docs

Contributing

Head over to the docs