Skip to content

Commit

Permalink
when adding property to an annotation source, each annotation needs t…
Browse files Browse the repository at this point in the history
…o have their properties updated
  • Loading branch information
chrisj committed Aug 22, 2024
1 parent 288c8bb commit 8c6f373
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/annotation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,9 @@ export class LocalAnnotationSource extends AnnotationSource {
addProperty(property: AnnotationPropertySpec) {
this.properties.push(property);
this.updateAnnotationPropertySerializers();
for (const annotation of this) {
annotation.properties.push(property.default);
}
this.changed.dispatch();
}

Expand Down
2 changes: 1 addition & 1 deletion src/layer/annotation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class TagTool extends LayerTool<AnnotationUserLayer> {
);
if (propertyIndex > -1) {
annotation.properties[propertyIndex] =
1 - (annotation.properties[propertyIndex] || 0);
1 - annotation.properties[propertyIndex];
localAnnotations.changed.dispatch();
this.layer.manager.root.selectionState.changed.dispatch(); // TODO, this is probably not the best way to handle it
}
Expand Down

0 comments on commit 8c6f373

Please sign in to comment.