Repository navigation
fix(deck.gl-geotiff): pass opacity and other inherited props to MosaicLayer sources - #789
Open
kylebarron wants to merge 1 commit into
Open
kylebarron wants to merge 1 commit into
kylebarron wants to merge 1 commit into
Conversation
…cLayer sources
MosaicLayer didn't pass on the props a composite layer normally hands its
sublayers, so `opacity`, `pickable`, `parameters`, `modelMatrix`,
`extensions` and the rest had no effect on the layers its sources render.
Its inner TileLayer was built from a fixed set of props rather than
`getSubLayerProps()`, and its `renderSubLayers` called `renderSource`
without the props TileLayer hands it.
Build the inner TileLayer from `this.getSubLayerProps()`, as deck.gl's
TerrainLayer does, keeping its `mosaic-layer-${id}` id. Then clone each
layer `renderSource` returns with the inherited props it didn't set
itself, so a source can still set its own `opacity`. A layer's own props
are the ones passed to its constructor, since deck.gl keeps defaults on
the props prototype. The inherited keys are the ones `getSubLayerProps()`
returns, less the per-layer `id` and `updateTriggers`.
Also say why `MosaicTileset2DFactory` must be a new class on every
render: it is what makes the inner TileLayer pick up new `sources` and
re-render loaded sources with a new `renderSource`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
MosaicLayerdidn't pass the props a composite layer normally hands its sublayers on to the layers its sources render, soopacity,pickable,parameters,modelMatrix,extensionsand the rest had no effect on them. Its innerTileLayerwas built from a fixed set of props rather thangetSubLayerProps(), and itsrenderSubLayerscalledrenderSourcewithout the propsTileLayerhands it. This builds the innerTileLayerfromthis.getSubLayerProps(), as deck.gl'sTerrainLayerdoes, and clones each layerrenderSourcereturns with the inherited props it didn't set itself, so a source can still set its ownopacity.Changes
TileLayerfromthis.getSubLayerProps(). Its id staysmosaic-layer-${id}.renderSubLayers, clone each layerrenderSourcereturns (a single layer,null, or nested arrays) with the inherited propsTileLayerpasses, except those the layer set itself. A layer's own props are the ones passed to its constructor (Object.hasOwn(layer.props, key)), since deck.gl keeps defaults on the props prototype.getSubLayerProps()returns, less the per-layeridandupdateTriggers, so per-tile props likeid,dataandtilenever reach a source's layers.renderSource, and comment on whyMosaicTileset2DFactorymust be a new class on every render: it makes the innerTileLayerpick up newsourcesand re-render loaded sources with a newrenderSource.Tests
opacityon aMosaicLayerreaches a source's layer.opacitykeeps it.opacityreaches a source that's already loaded, without fetching it again.opacityreaches every layer in nested arrays a source returns.Three of the four new tests fail against
main. The test that a source keeps its ownopacitypasses there too; it guards the own-prop rule.Notes
updateTriggers.allon aMosaicLayernow reaches the innerTileLayer, sincegetSubLayerProps()forwards it, so changing it reloads every source.TerrainLayerdrops it by overridingupdateTriggers; that's a one-line change if we'd rather not forward it.Closes #784
🤖 Written by Claude Code