Skip to content

Commit

Permalink
rewrote the Camera.LookAt get accessor to ensure that
Browse files Browse the repository at this point in the history
when the Camera as a body resource does not define a value for a LookAt property,
then the value returned is null
  • Loading branch information
vincentmarchetti committed Aug 19, 2024
1 parent 7c29217 commit 3c61b2d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,20 @@ export class Camera extends AnnotationBody {
* with an id matching the id of an Annotation instance.
**/
getLookAt() : object | PointSelector | null {
let rawObj = this.getPropertyAsObject("lookAt" )
if ( ! rawObj) return null;
let rawObj = this.getPropertyAsObject("lookAt" ) ?? null;
if ( rawObj == null ) return null;

let rawType = (rawObj["type"] || rawObj["@type"])
if (rawType == "Annotation"){
let rawType = (rawObj["type"] || rawObj["@type"]) ?? null;
if (rawType == null ) return null;

if (rawType == "Annotation")
return rawObj;
}
if (rawType == "PointSelector"){
else if (rawType == "PointSelector")
return new PointSelector(rawObj);
else{
console.error('unidentified value of lookAt ${rawType}');
return null;
}
throw new Error('unidentified value of lookAt ${rawType}');
}
get LookAt() : object | null {return this.getLookAt();}

Expand Down

0 comments on commit 3c61b2d

Please sign in to comment.