-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support for custom mapbox layer
Instead of using DeckGl as the container for Mapbox, we use Mapbox as the container for DeckGl layer. This lets us insert the deckgl layer between the mapbox layers, which is very handy when dealing with labels. We use DeckGL's custom Mapbox layer here. Since DeckGL's custom layer need method on the prototype, we can copy the layer props with spreading, otherwise we lose the methods. This is why the `layer` prop is added on the Layer so that we can pass the custom layer without any copying.
- Loading branch information
Showing
3 changed files
with
103 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
|
||
function Checkbox({name, value, onChange}) { | ||
return ( | ||
<div key={name} className="input"> | ||
<label>{name}</label> | ||
<input type="checkbox" checked={value} onChange={evt => onChange(name, evt.target.checked)} /> | ||
</div> | ||
); | ||
} | ||
|
||
function ControlPanel({ | ||
overLabels, | ||
setOverLabels | ||
}: { | ||
overLabels: boolean; | ||
setOverLabels: (v: boolean) => void; | ||
}) { | ||
return ( | ||
<div className="control-panel"> | ||
<h3>Deck.gl layer</h3> | ||
<p>A deck.gl overlay can be used and inserted inside the Mapbox layers.</p> | ||
<Checkbox | ||
name="Arcs over labels" | ||
value={overLabels} | ||
onChange={(name: string, v: boolean) => setOverLabels(v)} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default ControlPanel; |
This file contains 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