Repository navigation
A pass on refreshing picking and event handling docs - #850
Conversation
|
|
||
| let i = 0; | ||
| for (const object of data) { | ||
| const pickingColor = this.encodePickingColor(i); |
There was a problem hiding this comment.
const pickingColor = this.encodePickingColor(i);
Nit: should we use a separate index to pass to encodePickingColor for clarity, may be like:
let i = 0;
let objectIndex = 0;
for (const object of data) {
const pickingColor = this.encodePickingColor(objectIndex++);
value[i++] = ...
There was a problem hiding this comment.
Nit: should we use a separate index to pass to encodePickingColor for clarity, may be like:
Good suggestion. Now I don't think we should use two variables to represent the same thing, that seems confusing. I could just change i to objectIndex though.
d5c5dee to
c26be13
Compare
| ## Common Issues | ||
|
|
||
| A couple of particular things to watch out for that tend to have a big impact on performance: | ||
| * Be careful when enabling Retina/High DPI rendering. It generetes 4x the number of pixels (fragments) and can have a big performance impact that depends on which computer or monitor is being used. |
There was a problem hiding this comment.
Unrelated: is it necessary to draw the picking buffer in high DPI? Mouse coordinates are always in screen pixels.
There was a problem hiding this comment.
Unrelated: is it necessary to draw the picking buffer in high DPI? Mouse coordinates are always in screen pixels.
So what we are discussing now is to make it easy for the app to select whether to draw in High-DPI or not (since it has a significant perf impact), and maybe even add a checkbox to the examples enabling the user to try with and without.
I would expect that to be a new prop on the DeckGL (useHighDPI, useDevicePixelRation, useRetina or similar) and it would affect both normal render and picking.
Once that is done, a second reasonable question is whether we could use different values for picking and main rendering. For pixel perfect picking an app might want them to be the same, but many apps want to use a picking radius for better fat finger sensitivity and then it might not matter anyway.
I will add these comments to the open ticket #843.
| | `object` | The object that was picked. This is typically an entry in the layer's `props.data` array, but can vary from layer to layer. | | ||
| | `x` | Mouse position x relative to the viewport. | | ||
| | `y` | Mouse position y relative to the viewport. | | ||
| | `lngLat` | Mouse position in geospatial coordinates. Only applies if `layer.props.projectionMode` is a geospatial mode such as `COORDINATE_SYSTEM.LNGLAT`. | |
There was a problem hiding this comment.
With the addition of new viewports, maybe we should extend this field to be anything that viewport.unproject produces?
There was a problem hiding this comment.
With the addition of new viewports, maybe we should extend this field to be anything that viewport.unproject produces?
Good point. Should also check how this works with METER_OFFSET viewports. E.g. would it be valuable to get both the lngLat anchor and the offset as separate values, rather than a combined lngLat.
Some cleanup of the overall picking/interactivity/event-handling documentation complex.