Skip to content
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

CARTO: Add Layer exports to ease subclassing #9235

Merged
merged 5 commits into from
Nov 8, 2024
Merged

Conversation

felixpalmer
Copy link
Collaborator

Background

A number of the internal types & layers were not exported, making it hard to customize/subclass

Change List

  • Export all internal layers & prop types
  • Use getSubLayerClass in CompositeLayer to allow _subLayerProps: {'layer': type} injections

@coveralls
Copy link

coveralls commented Nov 7, 2024

Coverage Status

coverage: 91.618% (+0.002%) from 91.616%
when pulling b834a0f on felix/carto-exports
into 2de1bc5 on master.

modules/carto/src/index.ts Outdated Show resolved Hide resolved
data,
// TODO: Tileset2D should be generic over TileIndex type
TilesetClass: QuadbinTileset2D as any,
renderSubLayers,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking, that if we allow overriding TileLayer class, why not allowing overriding of RasterLayer too?

(that was something i wanted to do when experimenting with this class)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did consider that, but we have no precedent doing that elsewhere in TileLayer or subclasses. The design of TileLayer is to provide the renderSubLayers prop to allow the application to set (or override) the correct class. In this layer we hardcode it, preventing it from being set from the outside. Perhaps it would be better to move the definition of renderSubLayers to defaultProps like TileLayer does it?

@felixpalmer felixpalmer merged commit 2a08804 into master Nov 8, 2024
4 checks passed
@felixpalmer felixpalmer deleted the felix/carto-exports branch November 8, 2024 12:37
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.

4 participants