From 9f336c012818b9eea1c0e10005347c3012192d79 Mon Sep 17 00:00:00 2001 From: Taha <98838967+Taha-Hassan-Git@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:54:24 +0000 Subject: [PATCH] annotate canvas events (#2397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds annotation to the canvas events example ### Change Type - [ ] `patch` — Bug fix - [ ] `minor` — New feature - [ ] `major` — Breaking change - [ ] `dependencies` — Changes to package dependencies[^1] - [x] `documentation` — Changes to the documentation only[^2] - [ ] `tests` — Changes to any test code only[^2] - [ ] `internal` — Any other changes that don't affect the published package[^2] - [ ] I don't know [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Adds annotation to the canvas events example --- .../src/examples/canvas-events/CanvasEventsExample.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/examples/src/examples/canvas-events/CanvasEventsExample.tsx b/apps/examples/src/examples/canvas-events/CanvasEventsExample.tsx index 7234cf876..1bf66c86a 100644 --- a/apps/examples/src/examples/canvas-events/CanvasEventsExample.tsx +++ b/apps/examples/src/examples/canvas-events/CanvasEventsExample.tsx @@ -2,6 +2,8 @@ import { TLEventInfo, Tldraw } from '@tldraw/tldraw' import '@tldraw/tldraw/tldraw.css' import { useCallback, useState } from 'react' +// There's a guide at the bottom of this file! + export default function CanvasEventsExample() { const [events, setEvents] = useState([]) @@ -41,3 +43,10 @@ export default function CanvasEventsExample() { ) } + +/* +This example shows how to listen to canvas events. This includes things like pointer and +keyboard events, but not things such as undo/redo, create/delete shapes, etc. Those are store events. + +To listen to changes to the store, check out the store events example. +*/