Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.astro/
.vscode/
.idea/
dist/
node_modules/
.claude/

.env
.env.production
Expand Down
21 changes: 14 additions & 7 deletions src/content/docs/api-reference/image-annotator.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,23 @@ __Returns:__ [ImageAnnotation](/api-reference/imageannotation) | undefined
### setAnnotations

```js
anno.setAnnotations(annotations, replace = false);
anno.setAnnotations(annotations, replace = true);
```

Adds the given list of annotations to the image. Optionally, clearing the annotation layer first and replacing all
existing annotations.
Loads annotations into the annotator.

| Argument | Type | Default | Description |
|-------------|---------------------------------------------------|--------------|--------------------------------------------------------|
| annotations | [ImageAnnotation](/api-reference/imageannotation) | __required__ | The annotation objects. |
| replace | boolean | false | If `true`, new annotations will replace existing ones. |
When `replace` is `true` (the default), performs a diff-based reconciliation against the current store: annotations
present in both are updated in-place, new ones are added, and annotations absent from the incoming list are deleted.
Only annotations that are truly removed appear in the `deleted` changeset, so any active selection is preserved as
long as the selected annotation is included in the new payload.

When `replace` is `false`, the incoming annotations are appended to the store without touching existing entries. An
error is thrown if any incoming annotation ID already exists in the store.

| Argument | Type | Default | Description |
|-------------|---------------------------------------------------|--------------|-----------------------------------------------------------------------------------|
| annotations | [ImageAnnotation](/api-reference/imageannotation) | __required__ | The annotation objects. |
| replace | boolean | true | If `true`, reconciles annotations in-place. If `false`, appends without replacing. |

### setDrawingTool

Expand Down
21 changes: 14 additions & 7 deletions src/content/docs/api-reference/openseadragon-annotator.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,23 @@ __Returns:__ [ImageAnnotation](/api-reference/imageannotation) | undefined
### setAnnotations

```js
anno.setAnnotations(annotations, replace = false);
anno.setAnnotations(annotations, replace = true);
```

Adds the given list of annotations to the image. Optionally, clearing the annotation layer first and replacing all
existing annotations.
Loads annotations into the annotator.

| Argument | Type | Default | Description |
|-------------|---------------------------------------------------|--------------|--------------------------------------------------------|
| annotations | [ImageAnnotation](/api-reference/imageannotation) | __required__ | The annotation objects. |
| replace | boolean | false | If `true`, new annotations will replace existing ones. |
When `replace` is `true` (the default), performs a diff-based reconciliation against the current store: annotations
present in both are updated in-place, new ones are added, and annotations absent from the incoming list are deleted.
Only annotations that are truly removed appear in the `deleted` changeset, so any active selection is preserved as
long as the selected annotation is included in the new payload.

When `replace` is `false`, the incoming annotations are appended to the store without touching existing entries. An
error is thrown if any incoming annotation ID already exists in the store.

| Argument | Type | Default | Description |
|-------------|---------------------------------------------------|--------------|-----------------------------------------------------------------------------------|
| annotations | [ImageAnnotation](/api-reference/imageannotation) | __required__ | The annotation objects. |
| replace | boolean | true | If `true`, reconciles annotations in-place. If `false`, appends without replacing. |

### setDrawingTool

Expand Down