Hi!
We want to draw a line between a point on the tileset, and the mouse. So I registered a MOUSE_MOVE screen space event handler, that sets the `positions` after every move event.
The problem is that the line just doesn't appear at all, unless the mouse is still for about half a second. I did some research and came across a post that said something about the entity shipping of the render request to a web worker, and if you send a new one before the old one is done the old one is cancelled. That sounds like it could have this effect, but still does it really take ~500ms to get a 2 point polyline into that webworker? I have a feeling there's something else going on as well.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
// setup
viewer.screenSpaceEventHandler.setInputAction(
(movement: any) => this.handleMouseMove(movement),
Cesium.ScreenSpaceEventType.MOUSE_MOVE
)
// handler
handleMouseMove(movement: any) {
if (!this.measurementReady) {
const previousPoint = this.measurePoints[this.measurePoints.length - 1]
if (previousPoint) {
const position = this.viewer.scene.pickPosition(movement.endPosition)
this.measuredDistance =
this.measuredDistanceSoFar +
Cesium.Cartesian3.distance(previousPoint, position)
this.measuredDistanceLine.polyline.positions = [
this.measurePointA,
this.measurePointB,
]
this.updateMetaData()
}
}
}
The goal is to have a smooth UI where the user sees where the line is going to be before they commit to it. I understand that dynamic buffers are not done yet, but I imagine just sending two vertices to the gpu shouldn't take 500ms. If I should use the primitive api instead of the entity api, is there an example somewhere of rendering a polyline with some material applied to it the primitive way?
I'm using Cesium 1.55, in Chrome on MacOSX.