@fieldnotes/react 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -56,7 +56,7 @@ function App() {
56
56
  }
57
57
  ```
58
58
 
59
- Embedded React components are fully interactive clicks, inputs, forms all work normally.
59
+ Embedded components use a **two-mode interaction model**: by default they can be selected, dragged, and resized. **Double-click** to enter interact mode (clicks, inputs, forms work). **Escape** or click outside to exit.
60
60
 
61
61
  ## Hooks
62
62
 
@@ -116,6 +116,25 @@ function CameraInfo() {
116
116
  }
117
117
  ```
118
118
 
119
+ ### Changing Tool Options
120
+
121
+ Use `useViewport()` to access tool instances and change options at runtime:
122
+
123
+ ```tsx
124
+ import { useViewport } from '@fieldnotes/react';
125
+ import type { PencilTool } from '@fieldnotes/core';
126
+
127
+ function ColorPicker() {
128
+ const viewport = useViewport();
129
+
130
+ const setColor = (color: string) => {
131
+ viewport.toolManager.getTool<PencilTool>('pencil')?.setOptions({ color });
132
+ };
133
+
134
+ return <input type="color" onChange={(e) => setColor(e.target.value)} />;
135
+ }
136
+ ```
137
+
119
138
  ## Component API
120
139
 
121
140
  ### `<FieldNotesCanvas>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fieldnotes/react",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "React wrapper for Field Notes canvas SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@fieldnotes/core": "0.2.0"
21
+ "@fieldnotes/core": "0.2.1"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=18",