You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,17 +12,19 @@ Import action into page and pass and object with `ondraw` and `oncomplete` metho
12
12
13
13
Each will receive a path which can be rendered as SVG in your component. `ondraw` fires _while the user is drawing_ and would be the current stroke. `oncomplete` fires when they have finished the line (which could transition to a different color).
14
14
15
+
The stroke options can be override if desired.
16
+
15
17
## Example
16
18
17
19
```svelte
18
20
<script lang="ts">
19
21
import { signature } from 'svelte-signature-pad'
20
22
21
-
let layers: { path: string; width: number; height: number }[] = []
23
+
let layers: { path: string; width: number; height: number }[] = $state([])
22
24
23
-
let width: number
24
-
let height: number
25
-
let preview: string
25
+
let width = $state(0)
26
+
let height = $state(0)
27
+
let preview = $state<string>()
26
28
27
29
const ondraw = (path: string) => (preview = path)
28
30
const oncomplete = (path: string) => {
@@ -36,13 +38,13 @@ Each will receive a path which can be rendered as SVG in your component. `ondraw
0 commit comments