diff --git a/src/views/room/widgets/object-location/ObjectLocationView.tsx b/src/views/room/widgets/object-location/ObjectLocationView.tsx index c5f2b142..04bf1f20 100644 --- a/src/views/room/widgets/object-location/ObjectLocationView.tsx +++ b/src/views/room/widgets/object-location/ObjectLocationView.tsx @@ -5,7 +5,7 @@ import { ObjectLocationViewProps } from './ObjectLocationView.types'; export const ObjectLocationView: FC = props => { - const { objectId = -1, category = -1, children = null } = props; + const { objectId = -1, category = -1, noFollow = false, children = null } = props; const [ pos, setPos ] = useState<{ x: number, y: number }>({ x: -1, y: -1}); const elementRef = useRef(); @@ -31,13 +31,24 @@ export const ObjectLocationView: FC = props => useEffect(() => { - Nitro.instance.ticker.add(updatePosition); + let remove = false; + + if(noFollow) + { + updatePosition(); + } + else + { + remove = true; + + Nitro.instance.ticker.add(updatePosition); + } return () => { - Nitro.instance.ticker.remove(updatePosition); + if(remove) Nitro.instance.ticker.remove(updatePosition); } - }, [ updatePosition ]); + }, [ updatePosition, noFollow ]); return (
-1 ? 'visible' : 'invisible') } style={ { left: pos.x, top: pos.y } }> diff --git a/src/views/room/widgets/object-location/ObjectLocationView.types.ts b/src/views/room/widgets/object-location/ObjectLocationView.types.ts index 75e67971..8c29df71 100644 --- a/src/views/room/widgets/object-location/ObjectLocationView.types.ts +++ b/src/views/room/widgets/object-location/ObjectLocationView.types.ts @@ -2,4 +2,5 @@ export interface ObjectLocationViewProps { objectId: number; category: number; + noFollow?: boolean; }