Skip to content

A pass on refreshing picking and event handling docs - #850

Merged
ibgreen merged 2 commits into
masterfrom
picking-documentation
Aug 17, 2017
Merged

ibgreen merged 2 commits into
masterfrom
picking-documentation

Conversation

@ibgreen

@ibgreen ibgreen commented Aug 16, 2017

Copy link
Copy Markdown
Collaborator

Some cleanup of the overall picking/interactivity/event-handling documentation complex.

  • I tried to keep new features out of this pass so that it could be merged to current 4.1-release and website.
  • We should discuss how to add documentation for in-progress features such as auto highlighting, use of new picking module, and a presumably public EventManager class.

Comment thread docs/advanced/picking.md

let i = 0;
for (const object of data) {
const pickingColor = this.encodePickingColor(i);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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++] = ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ibgreen
ibgreen force-pushed the picking-documentation branch from d5c5dee to c26be13 Compare August 17, 2017 19:05
## 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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: is it necessary to draw the picking buffer in high DPI? Mouse coordinates are always in screen pixels.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the addition of new viewports, maybe we should extend this field to be anything that viewport.unproject produces?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants