Skip to content

Commit

Permalink
test deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Sep 19, 2024
1 parent d8a2502 commit e6c18f6
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 214 deletions.
17 changes: 12 additions & 5 deletions src/annotation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export function formatNumericProperty(
property: AnnotationNumericPropertySpec,
value: number,
): string {
console.log("formatNumericProperty");
const formattedValue =
property.type === "float32" ? value.toPrecision(6) : value.toString();
const { enumValues, enumLabels } = property;
Expand Down Expand Up @@ -618,7 +619,6 @@ function parseAnnotationPropertySpec(obj: unknown): AnnotationPropertySpec {
}

function annotationPropertySpecToJson(spec: AnnotationPropertySpec) {
console.log("annotationPropertySpecToJson", spec);
const defaultValue = spec.default;
const isNumeric = isAnnotationNumericPropertySpec(spec);
const tag = isNumeric ? spec.tag : undefined;
Expand Down Expand Up @@ -1298,6 +1298,7 @@ export class LocalAnnotationSource extends AnnotationSource {

this.registerDisposer(
properties.changed.add(() => {
console.log("properties changed!");
this.updateAnnotationPropertySerializers();
this.changed.dispatch();
}),
Expand All @@ -1313,25 +1314,31 @@ export class LocalAnnotationSource extends AnnotationSource {

addProperty(property: AnnotationPropertySpec) {
this.properties.value.push(property);
this.properties.changed.dispatch();
for (const annotation of this) {
annotation.properties.push(property.default);
}
this.changed.dispatch();
this.properties.changed.dispatch();
}

removeProperty(identifier: string) {
const propertyIndex = this.properties.value.findIndex(
(x) => x.identifier === identifier,
);
this.properties.value.splice(propertyIndex, 1);
this.properties.changed.dispatch();
for (const annotation of this) {
annotation.properties.splice(propertyIndex, 1);
}
this.changed.dispatch();
this.properties.changed.dispatch();
}

getTagProperties = () => {
const { properties } = this;
const numericProps = properties.value.filter(
isAnnotationNumericPropertySpec,
); // for type
return numericProps.filter((x) => x.tag);
};

ensureUpdated() {
const transform = this.watchableTransform.value;
const { curCoordinateTransform } = this;
Expand Down
Loading

0 comments on commit e6c18f6

Please sign in to comment.