Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
02d6e13
View model definitions
kylebarron Oct 8, 2025
ab8c55d
Allow none
kylebarron Oct 8, 2025
71b0b4e
Pass in views to Map constructor
kylebarron Oct 8, 2025
4bfd2ba
move html export to separate file
kylebarron Oct 8, 2025
f14cdba
move view_state down after view
kylebarron Oct 8, 2025
c490176
Set up maplibre basemap widet
kylebarron Oct 8, 2025
aaf66a3
Define split renderers
kylebarron Oct 14, 2025
ca7bfd4
Implement split renderers
kylebarron Oct 14, 2025
a043703
alphabetize
kylebarron Oct 14, 2025
fa0940c
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron Oct 14, 2025
879bff0
Merge branch 'main' into kyle/split-renderers2
kylebarron Oct 14, 2025
08ce7f8
Merge branch 'kyle/split-renderers2' into kyle/view-basemap-refactor
kylebarron Oct 14, 2025
18aacb4
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron Oct 14, 2025
e185723
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron Oct 15, 2025
05b1ec2
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron Oct 16, 2025
3571acf
reduce diff
kylebarron Oct 16, 2025
2e59606
Support deck views
kylebarron Oct 16, 2025
6ff3540
Apply linear gradient background
kylebarron Oct 16, 2025
e846164
Add dark background when in globe view
kylebarron Oct 16, 2025
8c88487
pass undefined when no views passed
kylebarron Oct 16, 2025
188164c
Remove multi-view support for now
kylebarron Oct 16, 2025
89d70eb
fix basemap when constructing `Map` without any parameters
kylebarron Oct 16, 2025
582d606
Let `views` be None
kylebarron Oct 16, 2025
9b8ebcc
remove accidental render_mode
kylebarron Oct 16, 2025
d72e7b7
reduce diff
kylebarron Oct 16, 2025
5ff4d12
remove controller
kylebarron Oct 17, 2025
a273191
Merge branch 'main' into kyle/view-basemap-refactor
kylebarron Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add dark background when in globe view
  • Loading branch information
kylebarron committed Oct 16, 2025
commit e84616461bc06c3f6cf0cc3070d12c6963b28816
8 changes: 6 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { useViewStateDebounced } from "./state";
import Toolbar from "./toolbar.js";
import { getTooltip } from "./tooltip/index.js";
import { Message } from "./types.js";
import { isDefined } from "./util.js";
import { isDefined, isGlobeView } from "./util.js";
import { MachineContext, MachineProvider } from "./xstate";
import * as selectors from "./xstate/selectors";

Expand Down Expand Up @@ -328,7 +328,11 @@ function App() {
style={{
width: "100%",
height: "100%",
background: "linear-gradient(0, #000, #223)",
// Use a dark background when in globe view so the globe is easier to
// delineate
...(isGlobeView(views) && {
background: "linear-gradient(0, #000, #223)",
}),
}}
>
<Toolbar />
Expand Down
6 changes: 2 additions & 4 deletions src/renderers/overlay.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { _GlobeView as GlobeView } from "@deck.gl/core";
import { MapboxOverlay, MapboxOverlayProps } from "@deck.gl/mapbox";
import React from "react";
import Map, { useControl } from "react-map-gl/maplibre";

import type { MapRendererProps, OverlayRendererProps } from "./types";
import { isGlobeView } from "../util";

/**
* DeckGLOverlay component that integrates deck.gl with react-map-gl
Expand Down Expand Up @@ -31,16 +31,14 @@ const OverlayRenderer: React.FC<MapRendererProps & OverlayRendererProps> = (
// Remove maplibre-specific props before passing to DeckGL
const { mapStyle, customAttribution, initialViewState, views, ...deckProps } =
mapProps;
const firstView = Array.isArray(views) ? views[0] : views;
const isGlobeView = firstView instanceof GlobeView;
return (
<Map
reuseMaps
initialViewState={initialViewState}
mapStyle={mapStyle}
attributionControl={{ customAttribution }}
style={{ width: "100%", height: "100%" }}
{...(isGlobeView && { projection: "globe" })}
{...(isGlobeView(views) && { projection: "globe" })}
>
<DeckGLOverlay
// https://deck.gl/docs/api-reference/core/deck#_typedarraymanagerprops
Expand Down
10 changes: 10 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** Check for null and undefined */

import { _GlobeView as GlobeView } from "@deck.gl/core";

import { MapRendererProps } from "./renderers";

// https://stackoverflow.com/a/52097445
export function isDefined<T>(value: T | undefined | null): value is T {
return value !== undefined && value !== null;
Expand All @@ -7,3 +12,8 @@ export function isDefined<T>(value: T | undefined | null): value is T {
export function makePolygon(pt1: number[], pt2: number[]) {
return [pt1, [pt1[0], pt2[1]], pt2, [pt2[0], pt1[1]], pt1];
}

export function isGlobeView(views: MapRendererProps["views"]) {
const firstView = Array.isArray(views) ? views[0] : views;
return firstView instanceof GlobeView;
}
Loading