我正在尝试在 onTick 事件中为时钟设置一个状态。
<Viewer>
<Clock
startTime={start.clone()}
stopTime={stop.clone()}
currentTime={start.clone()}
multiplier={50}
onTick={_.throttle(handleValue, 1000)} // this thing ticks every millisecond
/>
<Entity
ref={ref} // here is the ref to get the value I want to set state with
position={positionProperty}
tracked
selected
model={{ uri: model, minimumPixelSize: 100, maximumScale: 100.0 }}
availability={
new TimeIntervalCollection([
new TimeInterval({ start: start, stop: stop }),
])
}
/>
</Viewer>
Run Code Online (Sandbox Code Playgroud)
这是 handleValue 函数。
const handleValue = (clock) => {
//setting the state here ( I want to display the chaning …Run Code Online (Sandbox Code Playgroud)