@@ -2,14 +2,14 @@ import {Box, Line, Point, Segment, Vector} from '@flatten-js/core';
22import { minBy , round } from 'es-toolkit' ;
33import { max , min } from 'es-toolkit/compat' ;
44import {
5- ARROW_HEAD_LENGTH ,
6- ARROW_HEAD_WIDTH ,
7- MEASUREMENT_DECIMAL_PLACES ,
8- MEASUREMENT_EXTENSION_LENGTH ,
9- MEASUREMENT_FONT_SIZE ,
10- MEASUREMENT_LABEL_OFFSET ,
11- MEASUREMENT_ORIGIN_MARGIN ,
12- TO_RADIANS ,
5+ ARROW_HEAD_LENGTH ,
6+ ARROW_HEAD_WIDTH ,
7+ MEASUREMENT_DECIMAL_PLACES ,
8+ MEASUREMENT_EXTENSION_LENGTH ,
9+ MEASUREMENT_FONT_SIZE ,
10+ MEASUREMENT_LABEL_OFFSET ,
11+ MEASUREMENT_ORIGIN_MARGIN ,
12+ TO_RADIANS ,
1313} from '../App.consts' ;
1414import type { Shape , SnapPoint } from '../App.types' ;
1515import type { DrawController } from '../drawControllers/DrawController' ;
@@ -381,6 +381,9 @@ export class MeasurementEntity implements Entity {
381381 public static async fromJson (
382382 jsonEntity : JsonEntity < MeasurementJsonData >
383383 ) : Promise < MeasurementEntity > {
384+ if ( ! jsonEntity . shapeData ) {
385+ throw new Error ( 'Invalid JSON entity of type Measurement: missing shapeData' ) ;
386+ }
384387 const startPoint = new Point (
385388 jsonEntity . shapeData . startPoint . x ,
386389 jsonEntity . shapeData . startPoint . y
0 commit comments