Skip to content

Commit 339fa43

Browse files
felixpalmerPessimistress
authored andcommitted
fix(ColumnLayer): radiusUnits pixels (#10035)
1 parent fc1c242 commit 339fa43

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

examples/layer-browser/src/examples/core-layers.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,22 @@ const ScatterplotLayerExample = {
279279

280280
const ColumnLayerExample = {
281281
layer: ColumnLayer,
282+
propTypes: {
283+
radiusUnits: {type: 'compound', elements: ['radiusUnitsPixels']},
284+
radiusUnitsPixels: {
285+
type: 'boolean',
286+
onUpdate: (newValue, newSettings, change) => {
287+
change('radiusUnits', newValue ? 'pixels' : 'meters');
288+
}
289+
}
290+
},
282291
props: {
283292
id: 'columnLayer',
284293
data: dataSamples.worldGrid.data,
285294
extruded: true,
286295
pickable: true,
287296
radius: 100,
297+
radiusUnits: 'meters',
288298
opacity: 1,
289299
getFillColor: d => [245, 166, d.value * 255, 255],
290300
getElevation: d => d.value * 5000

modules/layers/src/column-layer/column-layer-vertex.glsl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ void main(void) {
6464
vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + column.offset) * dotRadius;
6565
if (column.radiusUnits == UNIT_METERS) {
6666
offset = project_size(offset);
67+
} else if (column.radiusUnits == UNIT_PIXELS) {
68+
offset = project_pixel_size(offset);
6769
}
6870
vec3 pos = vec3(offset, 0.);
6971
DECKGL_FILTER_SIZE(pos, geometry);

0 commit comments

Comments
 (0)