-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[website] Migrate 'plot' example to deck.gl v9 #8289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| vertexCount: gridPositions.length / 3 | ||
| }), | ||
| isInstanced: true | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, and types say isInstanced no longer exists, but is some indication of instancing expected at this point? state.instanceCount is not readily available but could be derived if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibgreen is this safe to remove? I see we still have it in ScatterplotLayer and other layers
| id: `${this.props.id}-grids`, | ||
| vs: gridVertex, | ||
| fs: fragmentShader, | ||
| bufferLayout: this.getAttributeManager().getBufferLayouts(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: When bufferLayout is omitted, type checking still passes and the layer silently displays nothing. To make updates to v9 a bit easier, I wonder if the types could be more strict about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
luma will autocreate the buffer layout for any attributes passed (so here just what is defined in the geometry, so I can see the logic in bufferLayout being optional. However, this pattern of adding more attributes via bufferLayout seems to be very common (at least in deck) and so maybe it would be good to make the type required, so that the user has to explicitly pass in [] to signal no additional buffers. @ibgreen thoughts?
In terms of failing silently, luma does complain if it cannot match a buffer, e.g.:
Model(PlotLayer-surface-surface): Ignoring buffer "instancePickingColors" for unknown attribute "instancePickingColors"
| return -1; | ||
| } | ||
| return [r / 255, g / 255]; | ||
| return [r / 255, g / 255] as $TODO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not a huge deal, but TypeScript complains that these types differ from the base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this method entirely, and rely on the Layer implementation. Then, modify getPickingInfo to reconstruct [r, g, b] from the index
ad036c1 to
2c1b5e2
Compare
| return -1; | ||
| } | ||
| return [r / 255, g / 255]; | ||
| return [r / 255, g / 255] as $TODO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this method entirely, and rely on the Layer implementation. Then, modify getPickingInfo to reconstruct [r, g, b] from the index
| vertexCount: gridPositions.length / 3 | ||
| }), | ||
| isInstanced: true | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ibgreen is this safe to remove? I see we still have it in ScatterplotLayer and other layers
2c1b5e2 to
5caed4e
Compare
|
Moving some inline conversations into main thread, as they've gotten detached in a rebase.
I've added additional type checks so that As far as I can tell we do need a
Fixed by adding
I agree this would be better, but the direct conversion is not working as I would've expected. Perhaps I've missed something about why these methods were added. For now I've just fixed the types to match the base class so we don't need If there are other concerns with the types, perhaps I should remove TypeScript from the PR for now? It might be easier to deal with the TS issues in a PR that isn't also reworking the code for v9. |
c60e21e to
84b14c8
Compare
|
I think it is best to not modify the typescript config with I can't figure out why your layer definition of state leads to an error when I think it would be a shame to remove the TypeScript as you've put in the effort and the types are helpful. In order to land this PR:
|
0167360 to
c90722d
Compare
✅ Done! |
Unblocks extending layer state in TS.
c90722d to
3cb2163
Compare
Updates
examples/website/plotto deck.gl v9. The migration was easier done with type-checking, and as discussed in #8266 I've left the layer files in TypeScript. I'm also happy to revert the types if we prefer that examples be plain JavaScript.There were a few things in the PR I wasn't sure about, and I'll add comments inline to call those out.