diff --git a/packages/aardvark-react/src/aardvark_standard_grabbable.tsx b/packages/aardvark-react/src/aardvark_standard_grabbable.tsx index bb2ed728..fc82ef3e 100644 --- a/packages/aardvark-react/src/aardvark_standard_grabbable.tsx +++ b/packages/aardvark-react/src/aardvark_standard_grabbable.tsx @@ -453,8 +453,6 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps infoVolume.nodeFromVolume.scale.z *= highlightScale; } - let volume: AvVolume = this.remoteComponent ? emptyVolume() : infoVolume; - let constraint: AvConstraint = null; if( this.props.gravityAligned ) { @@ -482,7 +480,7 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps else { outerComponent = this.moveableComponent; - outerVolume = volume; + outerVolume = infoVolume; outerConstraint = constraint; if( this.networkedComponent ) @@ -495,7 +493,7 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps case GrabbableStyle.LocalItem: outerComponent = this.moveableComponent; - outerVolume = volume; + outerVolume = infoVolume; outerConstraint = constraint; break; @@ -503,17 +501,17 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps if( AvGadget.instance().isRemote ) { outerComponent = this.remoteItemComponent; - outerVolume = infoVolume; + outerVolume = emptyVolume(); innerComponent = this.moveableComponent; - innerVolume = volume; + innerVolume = infoVolume; innerConstraint = constraint; if( this.moveableComponent.state == MoveableComponentState.Grabbed ) { - let lock = { ...this.remoteComponent.interfaceLocks[0] }; + let lock = { ...this.remoteItemComponent.interfaceLocks[0] }; lock.iface = k_remoteGrabbableInterface; - locatorEntity = } @@ -521,10 +519,11 @@ export class AvStandardGrabbable extends React.Component< StandardGrabbableProps else { outerComponent = this.moveableComponent; - outerVolume = volume; + outerVolume = infoVolume; outerConstraint = constraint; innerComponent = this.networkedItemComponent; + innerVolume = infiniteVolume(); } break; } diff --git a/websrc/whiteboard/src/whiteboard_main.tsx b/websrc/whiteboard/src/whiteboard_main.tsx index 6759a8a9..c93b49dc 100644 --- a/websrc/whiteboard/src/whiteboard_main.tsx +++ b/websrc/whiteboard/src/whiteboard_main.tsx @@ -1,4 +1,4 @@ -import { NetworkedItemComponent, ActiveInterface, AvComposedEntity, AvGadget, AvInterfaceEntity, AvLine, AvModel, AvPrimitive, AvStandardGrabbable, AvTransform, MoveableComponent, PrimitiveType, PrimitiveYOrigin, PrimitiveZOrigin, DefaultLanding, RemoteItemComponent, MoveableComponentState, k_remoteGrabbableInterface, GrabbableStyle } from '@aardvarkxr/aardvark-react'; +import { ShowGrabbableChildren, NetworkedItemComponent, ActiveInterface, AvComposedEntity, AvGadget, AvInterfaceEntity, AvLine, AvModel, AvPrimitive, AvStandardGrabbable, AvTransform, MoveableComponent, PrimitiveType, PrimitiveYOrigin, PrimitiveZOrigin, DefaultLanding, RemoteItemComponent, MoveableComponentState, k_remoteGrabbableInterface, GrabbableStyle } from '@aardvarkxr/aardvark-react'; import { Av, AvNodeTransform, AvVector, AvVolume, endpointAddrToString, EVolumeType, g_builtinModelBox, InitialInterfaceLock, infiniteVolume } from '@aardvarkxr/aardvark-shared'; import { vec2 } from '@tlaukkan/tsm'; import bind from 'bind-decorator'; @@ -80,78 +80,6 @@ interface MarkerProps thickness: number; } -interface AvRemoteGrabbableProps -{ - itemId: string; - volume: AvVolume | AvVolume[]; -} - -interface AvRemoteGrabbableState -{ - moveableState: MoveableComponentState; -} - -class AvNetworkedGrabbable extends React.Component< AvRemoteGrabbableProps, AvRemoteGrabbableState > -{ - private moveableComponent = new MoveableComponent( this.onMoveableUpdate, false, false ); - private remoteComponent: RemoteItemComponent = null; - private networkComponent: NetworkedItemComponent = null - - constructor( props: any ) - { - super( props ); - - this.state = - { - moveableState: MoveableComponentState.Idle, - }; - - if( AvGadget.instance().isRemote ) - { - this.remoteComponent = new RemoteItemComponent( this.props.itemId, () => {} ); - } - else - { - this.networkComponent = new NetworkedItemComponent( this.props.itemId, () => {} ); - } - } - - @bind - private onMoveableUpdate() - { - this.setState( { moveableState: this.moveableComponent.state } ); - } - - render() - { - if( AvGadget.instance().isRemote ) - { - let lock = { ...this.remoteComponent.interfaceLocks[0] }; - lock.iface = k_remoteGrabbableInterface; - return - - { - - this.state.moveableState == MoveableComponentState.Grabbed && - - } - { this.props.children } - - ; - } - else - { - return - - { this.props.children } - - ; - } - } -} - function Marker( props: MarkerProps ) { @@ -192,19 +120,26 @@ function Marker( props: MarkerProps ) } as AvVolume; return - - - - - + + + + + + + }> - + + ; }