Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9f0c4b8
chore(core) Adopt luma CanvasContext
ibgreen Apr 16, 2026
0000d5a
fix
ibgreen Apr 16, 2026
97d1cfe
Merge branch 'master' into ib/canvas-context-93
chrisgervang May 6, 2026
8076215
chore(core): route canvas sizing through CanvasContext
ibgreen May 8, 2026
1a84865
fix(google-maps): update overlay style container
ibgreen May 11, 2026
99803a5
fix(core): sync attached gl drawing buffer on resize
ibgreen May 11, 2026
8d8f329
prettier
ibgreen May 11, 2026
e69f9f4
docs: add agent merge guidance
ibgreen May 11, 2026
d4a0574
fix(react): preserve element props typing
ibgreen May 11, 2026
8d95fcf
Merge branch 'master' into ib/canvas-context-93
ibgreen May 13, 2026
f39d9c2
docs: expand merge readiness guidance
ibgreen May 13, 2026
cc3a261
fix
ibgreen May 13, 2026
b13922f
test(core): isolate canvas context resize devices
ibgreen May 13, 2026
9e26875
Revert "test(core): isolate canvas context resize devices"
ibgreen May 13, 2026
f83ab0d
test(core): avoid shared canvas context mutation
ibgreen May 13, 2026
cdeac8f
test(core): avoid shared picker canvas context mutation
ibgreen May 13, 2026
2e46973
fix(core): only forward explicit device pixel ratio
ibgreen May 13, 2026
90358e6
fix(core): avoid replaying default props into canvas context
ibgreen May 13, 2026
aa1cbb7
fix(core): repopulate invalid picking color cache
ibgreen May 13, 2026
2c0070d
Address comments
ibgreen May 13, 2026
fbdf106
feat(examples): add useDevicePixels toggle to basemap-browser
chrisgervang May 22, 2026
fd19f6d
feat(examples): use basemap pixelRatio for interleaved mode + add CDN…
chrisgervang May 27, 2026
82902eb
Merge remote-tracking branch 'origin/master' into chrisgervang/basema…
chrisgervang May 27, 2026
cbecd54
fix(examples): persist useDevicePixels in URL params
chrisgervang May 27, 2026
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
4 changes: 3 additions & 1 deletion examples/basemap-browser/src/config/build-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export function buildConfig(
dimensions: Dimensions,
onViewStateChange?: ViewStateChangeCallback
): Config {
const {basemap, framework, interleaved, globe, multiView, maskDemo, stressTest} = dimensions;
const {basemap, framework, interleaved, globe, multiView, maskDemo, stressTest, useDevicePixels} =
dimensions;

// Validate dimensions (warnings only)
const validation = validateDimensions(dimensions);
Expand Down Expand Up @@ -58,6 +59,7 @@ export function buildConfig(
multiView,
maskDemo,
stressTest,
useDevicePixels,

// Computed configuration
mapStyle,
Expand Down
3 changes: 2 additions & 1 deletion examples/basemap-browser/src/config/dimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const DEFAULT_DIMENSIONS: Dimensions = {
globe: false,
multiView: false,
maskDemo: false,
stressTest: 'none'
stressTest: 'none',
useDevicePixels: true
};

/**
Expand Down
29 changes: 29 additions & 0 deletions examples/basemap-browser/src/control-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ function getDimensionsFromUrl(): Partial<Dimensions> {
result.stressTest = stressTest;
}

if (params.has('useDevicePixels')) {
const udp = params.get('useDevicePixels');
if (udp === 'true') {
result.useDevicePixels = true;
} else if (udp === 'false') {
result.useDevicePixels = false;
} else {
const num = Number(udp);
if (Number.isFinite(num) && num > 0) {
result.useDevicePixels = num;
}
}
}

return result;
}

Expand All @@ -81,6 +95,7 @@ function setUrlFromDimensions(dimensions: Dimensions) {
params.set('multiView', String(dimensions.multiView));
params.set('maskDemo', String(dimensions.maskDemo));
params.set('stressTest', dimensions.stressTest);
params.set('useDevicePixels', String(dimensions.useDevicePixels));
const newUrl = `${window.location.pathname}?${params.toString()}`;
window.history.replaceState({}, '', newUrl);
}
Expand Down Expand Up @@ -262,6 +277,20 @@ export default function ControlPanel({onConfigChange}: ControlPanelProps) {
</label>
</div>

{/* Pixel Ratio Override */}
<div className="section">
<label>
<input
type="checkbox"
checked={dimensions.useDevicePixels !== true}
onChange={() =>
updateDimension('useDevicePixels', dimensions.useDevicePixels === true ? 1.5 : true)
}
/>
Override Pixel Ratio (1.5)
</label>
</div>
Comment thread
cursor[bot] marked this conversation as resolved.

{/* Stress Test Selection */}
<div className="section">
<div className="label">Stress Test:</div>
Expand Down
15 changes: 12 additions & 3 deletions examples/basemap-browser/src/renderers/pure-js/deck-only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import type {Config} from '../../types';
import {getBaseMapViewState} from '../../config';

export function mount(container: HTMLElement, config: Config): () => void {
const {initialViewState, layers, multiView, views, layerFilter, globe, onViewStateChange} =
config;
const {
initialViewState,
layers,
multiView,
views,
layerFilter,
globe,
useDevicePixels,
onViewStateChange
} = config;

// Create a wrapper div for Deck to render into
const wrapper = document.createElement('div');
Expand All @@ -24,7 +32,8 @@ export function mount(container: HTMLElement, config: Config): () => void {
height: '100%',
initialViewState: viewState,
controller: true,
layers
layers,
useDevicePixels
};

// Use GlobeView for globe projection
Expand Down
5 changes: 3 additions & 2 deletions examples/basemap-browser/src/renderers/pure-js/google-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function loadGoogleMapsAPI(apiKey: string): Promise<any> {
}

export function mount(container: HTMLElement, config: Config): () => void {
const {initialViewState, layers, interleaved, onViewStateChange} = config;
const {initialViewState, layers, interleaved, useDevicePixels, onViewStateChange} = config;
const viewState = getBaseMapViewState(initialViewState);

// eslint-disable-next-line no-process-env
Expand Down Expand Up @@ -84,7 +84,8 @@ export function mount(container: HTMLElement, config: Config): () => void {

overlay = new GoogleMapsOverlay({
interleaved,
layers
layers,
useDevicePixels
});

overlay.setMap(map);
Expand Down
14 changes: 11 additions & 3 deletions examples/basemap-browser/src/renderers/pure-js/mapbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function mount(container: HTMLElement, config: Config): () => void {
multiView,
views,
layerFilter,
useDevicePixels,
onViewStateChange
} = config;

Expand All @@ -38,18 +39,25 @@ export function mount(container: HTMLElement, config: Config): () => void {
// For multi-view, extract the mapbox view state for the base map
const mapInitialViewState = getBaseMapViewState(initialViewState);

const map = new mapboxgl.Map({
const mapOpts: any = {
container,
style: mapStyle,
center: [mapInitialViewState.longitude, mapInitialViewState.latitude],
zoom: mapInitialViewState.zoom,
bearing: mapInitialViewState.bearing || 0,
pitch: mapInitialViewState.pitch || 0
});
};
if (typeof useDevicePixels === 'number') {
mapOpts.pixelRatio = useDevicePixels;
} else if (useDevicePixels === false) {
mapOpts.pixelRatio = 1;
}
const map = new mapboxgl.Map(mapOpts);

const overlayConfig: any = {
interleaved,
layers
layers,
useDevicePixels
};

if (multiView && views) {
Expand Down
14 changes: 11 additions & 3 deletions examples/basemap-browser/src/renderers/pure-js/maplibre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,32 @@ export function mount(container: HTMLElement, config: Config): () => void {
multiView,
views,
layerFilter,
useDevicePixels,
onViewStateChange
} = config;

// For multi-view, extract the mapbox view state for the base map
const mapInitialViewState = getBaseMapViewState(initialViewState);

const map = new maplibregl.Map({
const mapOpts: maplibregl.MapOptions = {
container,
style: mapStyle,
center: [mapInitialViewState.longitude, mapInitialViewState.latitude],
zoom: mapInitialViewState.zoom,
bearing: mapInitialViewState.bearing || 0,
pitch: mapInitialViewState.pitch || 0
});
};
if (typeof useDevicePixels === 'number') {
mapOpts.pixelRatio = useDevicePixels;
} else if (useDevicePixels === false) {
mapOpts.pixelRatio = 1;
}
const map = new maplibregl.Map(mapOpts);

const overlayConfig: any = {
interleaved,
layers
layers,
useDevicePixels
};

if (multiView && views) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ type DeckOnlyComponentProps = {
};

export default function DeckOnlyComponent({config}: DeckOnlyComponentProps) {
const {initialViewState, layers, multiView, views, layerFilter, globe, onViewStateChange} =
config;
const {
initialViewState,
layers,
multiView,
views,
layerFilter,
globe,
useDevicePixels,
onViewStateChange
} = config;

const handleViewStateChange = useCallback(
({viewState: vs}: {viewState: any}) => {
Expand Down Expand Up @@ -63,6 +71,7 @@ export default function DeckOnlyComponent({config}: DeckOnlyComponentProps) {
controller={true}
layers={layers}
views={effectiveViews}
useDevicePixels={useDevicePixels}
layerFilter={multiView ? layerFilter : undefined}
onViewStateChange={handleViewStateChange}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ import {getBaseMapViewState} from '../../config';
function GoogleMapsDeckOverlay({
layers,
interleaved,
useDevicePixels,
onViewStateChange
}: {
layers: any[];
interleaved: boolean;
useDevicePixels?: boolean | number;
onViewStateChange?: (vs: InitialViewState) => void;
}) {
const map = useMap();
const overlay = useMemo(() => new GoogleMapsOverlay({interleaved}), [interleaved]);
const overlay = useMemo(
() => new GoogleMapsOverlay({interleaved, useDevicePixels}),
[interleaved, useDevicePixels]
);

useEffect(() => {
if (map) {
Expand Down Expand Up @@ -62,7 +67,7 @@ export default function GoogleMapsComponent({config}: GoogleMapsComponentProps)
// eslint-disable-next-line no-process-env
const mapId = process.env.GoogleMapsMapId || 'DEMO_MAP_ID';

const {initialViewState, layers, interleaved, onViewStateChange} = config;
const {initialViewState, layers, interleaved, useDevicePixels, onViewStateChange} = config;
const viewState = getBaseMapViewState(initialViewState);

return (
Expand All @@ -79,6 +84,7 @@ export default function GoogleMapsComponent({config}: GoogleMapsComponentProps)
<GoogleMapsDeckOverlay
layers={layers}
interleaved={interleaved}
useDevicePixels={useDevicePixels}
onViewStateChange={onViewStateChange}
/>
</GoogleMap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function MapboxComponent({config}: MapboxComponentProps) {
multiView,
views,
layerFilter,
useDevicePixels,
onViewStateChange
} = config;

Expand All @@ -42,10 +43,17 @@ export default function MapboxComponent({config}: MapboxComponentProps) {
return (
<div style={{width: '100%', height: '100%'}}>
<MapboxMap
key={`mapbox-${interleaved}-${multiView}`}
key={`mapbox-${interleaved}-${multiView}-${useDevicePixels}`}
mapStyle={mapStyle}
mapboxAccessToken={MAPBOX_TOKEN}
initialViewState={mapInitialViewState}
pixelRatio={
typeof useDevicePixels === 'number'
? useDevicePixels
: useDevicePixels === false
? 1
: undefined
}
onMove={e => {
onViewStateChange?.({
latitude: e.viewState.latitude,
Expand All @@ -59,6 +67,7 @@ export default function MapboxComponent({config}: MapboxComponentProps) {
<MapboxDeckOverlay
layers={layers}
interleaved={interleaved}
useDevicePixels={useDevicePixels}
views={multiView ? views : undefined}
layerFilter={multiView ? layerFilter : undefined}
initialViewState={multiView ? initialViewState : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function MapLibreComponent({config}: MapLibreComponentProps) {
multiView,
views,
layerFilter,
useDevicePixels,
onViewStateChange
} = config;

Expand Down Expand Up @@ -58,9 +59,16 @@ export default function MapLibreComponent({config}: MapLibreComponentProps) {
return (
<div style={{width: '100%', height: '100%'}}>
<MapLibreMap
key={`maplibre-${interleaved}-${globe}-${multiView}`}
key={`maplibre-${interleaved}-${globe}-${multiView}-${useDevicePixels}`}
mapStyle={mapStyle}
initialViewState={mapInitialViewState}
pixelRatio={
typeof useDevicePixels === 'number'
? useDevicePixels
: useDevicePixels === false
? 1
: undefined
}
onLoad={e => {
if (globe && isMountedRef.current) {
// Set projection before rendering overlay (critical for globe + interleaved mode)
Expand Down Expand Up @@ -90,6 +98,7 @@ export default function MapLibreComponent({config}: MapLibreComponentProps) {
<MapLibreDeckOverlay
layers={layers}
interleaved={interleaved}
useDevicePixels={useDevicePixels}
views={multiView ? views : undefined}
layerFilter={multiView ? layerFilter : undefined}
initialViewState={multiView ? initialViewState : undefined}
Expand Down
2 changes: 2 additions & 0 deletions examples/basemap-browser/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type Dimensions = {
multiView: boolean;
maskDemo: boolean;
stressTest: StressTest;
useDevicePixels: boolean | number;
};

// ===== Validation Types =====
Expand Down Expand Up @@ -69,6 +70,7 @@ export type Config = {
multiView: boolean;
maskDemo: boolean;
stressTest: StressTest;
useDevicePixels: boolean | number;

// Computed configuration
mapStyle: string;
Expand Down
Loading
Loading