Skip to content

Commit

Permalink
Exposed id of the grabbable from AvStandardGrabbable
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeLudwig committed Oct 14, 2020
1 parent ff791bf commit 59c5c8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/aardvark-react/src/aardvark_standard_grabbable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AvConstraint, AvNodeTransform, AvVolume, emptyVolume, EVolumeType, g_builtinModelStar, g_builtinModelTrashcan, infiniteVolume, InitialInterfaceLock, MinimalPose } from '@aardvarkxr/aardvark-shared';
import { AvConstraint, AvNodeTransform, AvVolume, emptyVolume, EndpointAddr, EVolumeType, g_builtinModelStar, g_builtinModelTrashcan, infiniteVolume, InitialInterfaceLock, MinimalPose } from '@aardvarkxr/aardvark-shared';
import bind from 'bind-decorator';
import React from 'react';
import { AvComposedEntity, EntityComponent } from './aardvark_composed_entity';
Expand Down Expand Up @@ -232,6 +232,7 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps
private gadgetListRef: React.RefObject<AvGadgetList> = React.createRef<AvGadgetList>();
private remoteItemComponent: RemoteItemComponent = null;
private networkedItemComponent: NetworkedItemComponent = null
private grabbableRef = React.createRef< AvComposedEntity >();

constructor( props: any )
{
Expand Down Expand Up @@ -405,6 +406,12 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps
}
}

/** Returns the global ID if the grabbable within the AvStandardGrabbable. */
public get globalId() : EndpointAddr
{
return this.grabbableRef.current?.globalId;
}

public render()
{
let showChildren: boolean;
Expand Down Expand Up @@ -594,7 +601,7 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps
}

return <AvComposedEntity components={ components } volume={ entityVolume }
constraint={ constraint } debugName={ debugName }>
constraint={ constraint } debugName={ debugName } ref={ this.grabbableRef }>
{ locatorEntity }
{ appearance }
{ children }
Expand Down

0 comments on commit 59c5c8f

Please sign in to comment.