@kepler.gl/deckgl-layers 3.3.0-alpha.24 → 3.3.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/globe/globe-backface-cull.js +3 -6
- package/dist/cjs/globe/globe-backface-cull.js.map +1 -1
- package/dist/cjs/globe/index.js +7 -0
- package/dist/cjs/globe/index.js.map +1 -1
- package/dist/cjs/globe/mvt-label-layer.js +2 -0
- package/dist/cjs/globe/mvt-label-layer.js.map +1 -1
- package/dist/esm/globe/globe-backface-cull.js +3 -6
- package/dist/esm/globe/globe-backface-cull.js.map +1 -1
- package/dist/esm/globe/index.js +1 -0
- package/dist/esm/globe/index.js.map +1 -1
- package/dist/esm/globe/mvt-label-layer.js +2 -0
- package/dist/esm/globe/mvt-label-layer.js.map +1 -1
- package/dist/globe/index.d.ts +1 -0
- package/package.json +4 -4
|
@@ -13,11 +13,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
13
|
|
|
14
14
|
// Back-face culling for globe-mode text labels.
|
|
15
15
|
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// original snippet; do not change the horizon formula here without treating it as a
|
|
19
|
-
// behavior change for every globe label that already uses EnhancedMultiIconLayer
|
|
20
|
-
// (including MVTLabelLayer basemap place names).
|
|
16
|
+
// Shared by the glyph and text-background sublayers, including MVTLabelLayer
|
|
17
|
+
// basemap place names.
|
|
21
18
|
//
|
|
22
19
|
// deck.gl's TextLayer uses a MultiIconLayer to render glyphs; on a globe, labels
|
|
23
20
|
// anchored on the far hemisphere would otherwise be drawn "through" the planet.
|
|
@@ -35,7 +32,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
35
32
|
// distance from the globe center.
|
|
36
33
|
// This is zoom-independent: the visible cap automatically shrinks as you zoom in and
|
|
37
34
|
// grows as you pull back, so labels don't pop in/out at the limb while zooming.
|
|
38
|
-
var BACKFACE_CULL_INJECT = /* glsl */"\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n //
|
|
35
|
+
var BACKFACE_CULL_INJECT = /* glsl */"\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n // Shrink the visible cap slightly to avoid glyphs smeared along the limb.\n // Scale the margin with the cap: a fixed +0.02 exceeds 1 as the camera\n // approaches the surface, incorrectly culling every label at city zooms.\n float cosHorizon = mix(radius / camDist, 1.0, 0.02);\n if (cosSurface < cosHorizon) {\n // Push the vertex outside clip space so this glyph is discarded. The hook\n // exposes the clip-space position as `position`, not `gl_Position`.\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n }\n";
|
|
39
36
|
|
|
40
37
|
/**
|
|
41
38
|
* Appends the globe back-face cull snippet to a layer's vertex position hook,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globe-backface-cull.js","names":["BACKFACE_CULL_INJECT","injectGlobeBackfaceCull","shaders","_shaders$inject","existingRaw","inject","existing","injection","_objectSpread","concat"],"sources":["../../../src/globe/globe-backface-cull.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Back-face culling for globe-mode text labels.\n//\n//
|
|
1
|
+
{"version":3,"file":"globe-backface-cull.js","names":["BACKFACE_CULL_INJECT","injectGlobeBackfaceCull","shaders","_shaders$inject","existingRaw","inject","existing","injection","_objectSpread","concat"],"sources":["../../../src/globe/globe-backface-cull.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Back-face culling for globe-mode text labels.\n//\n// Shared by the glyph and text-background sublayers, including MVTLabelLayer\n// basemap place names.\n//\n// deck.gl's TextLayer uses a MultiIconLayer to render glyphs; on a globe, labels\n// anchored on the far hemisphere would otherwise be drawn \"through\" the planet.\n// This injects a small GLSL snippet into the vertex shader that degenerates\n// (collapses) glyph vertices whose anchor is facing away from the camera, so\n// back-side labels disappear.\n//\n// The test uses the true sphere-horizon condition rather than a fixed dot-product\n// cutoff. In deck.gl common space the globe is a sphere centered at the origin, so:\n// - the label anchor position doubles as its outward surface normal, and\n// - a surface point is visible from the camera exactly when the angle between its\n// normal and the camera direction is within the horizon half-angle, i.e.\n// dot(normalize(anchor), normalize(cameraPos)) > R / d\n// where R is the sphere radius (= |anchor|) and d = |cameraPos| is the camera\n// distance from the globe center.\n// This is zoom-independent: the visible cap automatically shrinks as you zoom in and\n// grows as you pull back, so labels don't pop in/out at the limb while zooming.\nconst BACKFACE_CULL_INJECT = /* glsl */ `\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n // Shrink the visible cap slightly to avoid glyphs smeared along the limb.\n // Scale the margin with the cap: a fixed +0.02 exceeds 1 as the camera\n // approaches the surface, incorrectly culling every label at city zooms.\n float cosHorizon = mix(radius / camDist, 1.0, 0.02);\n if (cosSurface < cosHorizon) {\n // Push the vertex outside clip space so this glyph is discarded. The hook\n // exposes the clip-space position as \\`position\\`, not \\`gl_Position\\`.\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n }\n`;\n\n/**\n * Appends the globe back-face cull snippet to a layer's vertex position hook,\n * preserving anything the base layer already injected there.\n * Copied from EnhancedMultiIconLayer.getShaders().\n */\nexport function injectGlobeBackfaceCull(shaders: any): any {\n const existingRaw = shaders.inject?.['vs:DECKGL_FILTER_GL_POSITION'] || '';\n const existing = typeof existingRaw === 'string' ? existingRaw : existingRaw.injection || '';\n return {\n ...shaders,\n inject: {\n ...(shaders.inject || {}),\n 'vs:DECKGL_FILTER_GL_POSITION': `${existing}\\n${BACKFACE_CULL_INJECT}`\n }\n };\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,+hCAoB5B;;AAED;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAACC,OAAY,EAAO;EAAA,IAAAC,eAAA;EACzD,IAAMC,WAAW,GAAG,EAAAD,eAAA,GAAAD,OAAO,CAACG,MAAM,cAAAF,eAAA,uBAAdA,eAAA,CAAiB,8BAA8B,CAAC,KAAI,EAAE;EAC1E,IAAMG,QAAQ,GAAG,OAAOF,WAAW,KAAK,QAAQ,GAAGA,WAAW,GAAGA,WAAW,CAACG,SAAS,IAAI,EAAE;EAC5F,OAAAC,aAAA,CAAAA,aAAA,KACKN,OAAO;IACVG,MAAM,EAAAG,aAAA,CAAAA,aAAA,KACAN,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;MACxB,8BAA8B,KAAAI,MAAA,CAAKH,QAAQ,QAAAG,MAAA,CAAKT,oBAAoB;IAAE;EACvE;AAEL","ignoreList":[]}
|
package/dist/cjs/globe/index.js
CHANGED
|
@@ -136,6 +136,12 @@ Object.defineProperty(exports, "getStarsBackgroundStyle", {
|
|
|
136
136
|
return _globeStarsLayer.getStarsBackgroundStyle;
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
+
Object.defineProperty(exports, "injectGlobeBackfaceCull", {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function get() {
|
|
142
|
+
return _globeBackfaceCull.injectGlobeBackfaceCull;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
139
145
|
Object.defineProperty(exports, "resolveGlobeBasemapProvider", {
|
|
140
146
|
enumerable: true,
|
|
141
147
|
get: function get() {
|
|
@@ -147,6 +153,7 @@ var _globeDepthDiskLayer = require("./globe-depth-disk-layer");
|
|
|
147
153
|
var _globeLayers = require("./globe-layers");
|
|
148
154
|
var _mvtLabelLayer = require("./mvt-label-layer");
|
|
149
155
|
var _enhancedMultiIconLayer = _interopRequireDefault(require("./enhanced-multi-icon-layer"));
|
|
156
|
+
var _globeBackfaceCull = require("./globe-backface-cull");
|
|
150
157
|
var _enhancedTextBackgroundLayer = _interopRequireDefault(require("./enhanced-text-background-layer"));
|
|
151
158
|
var _globeView = require("./globe-view");
|
|
152
159
|
var _globeStarsLayer = require("./globe-stars-layer");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_atmosphereLayer","require","_globeDepthDiskLayer","_globeLayers","_mvtLabelLayer","_enhancedMultiIconLayer","_interopRequireDefault","_enhancedTextBackgroundLayer","_globeView","_globeStarsLayer"],"sources":["../../../src/globe/index.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Globe mode layer adjustments.\n//\n// Globe-specific adjustments handled here:\n// - Grid / Hexagon aggregation cells on the globe: deck.gl 9.x's GridCellLayer /\n// HexagonCellLayer position cells in flat mercator common space and draw them with\n// project_common_position_to_clipspace, which leaves them on the XY plane through the\n// globe center rather than on its surface. ScaleEnhancedGridLayer /\n// ScaleEnhancedHexagonLayer swap in a globe-aware cell subclass (see\n// layer-utils/globe-cell-utils) that remaps each cell vertex from common space back to\n// lng/lat and onto the sphere.\n// - Text/Label rendering with back-face culling: MVTLabelLayer renders place labels via a\n// TextLayer whose glyph sublayer is EnhancedMultiIconLayer, which degenerates glyph\n// vertices on the far side of the globe so labels don't show through the planet.\n// User layer text labels reuse the same inject (see globe-backface-cull) and, when a\n// background is enabled, EnhancedTextBackgroundLayer — a copy of EnhancedMultiIconLayer\n// for the background sublayer. The GLSL itself is unchanged from EnhancedMultiIconLayer.\n\nexport {\n AtmosphereLayerRealistic,\n AtmosphereSkyLayerRealistic,\n AtmosphereHugeHaloLayer,\n getGlobeAtmosphereLayer,\n getGlobeAtmosphereSkyLayer,\n getGlobeHugeHaloLayer\n} from './atmosphere-layer';\nexport {GlobeDepthDiskLayer, getGlobeDepthDiskLayer} from './globe-depth-disk-layer';\nexport {\n getGlobeBaseLayers,\n getGlobeTopLayers,\n getGlobeClearColor,\n getGlobeBasemapAttributions,\n resolveGlobeBasemapProvider,\n DEFAULT_BASEMAP_COLOR,\n getBasemapColors,\n getBasemapColorsForStyle\n} from './globe-layers';\nexport type {GlobeBasemapProvider, GlobeAttribution} from './globe-layers';\nexport {MVTLabelLayer} from './mvt-label-layer';\nexport {default as EnhancedMultiIconLayer} from './enhanced-multi-icon-layer';\nexport {default as EnhancedTextBackgroundLayer} from './enhanced-text-background-layer';\nexport {KeplerGlobeView} from './globe-view';\nexport {getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground} from './globe-stars-layer';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_atmosphereLayer","require","_globeDepthDiskLayer","_globeLayers","_mvtLabelLayer","_enhancedMultiIconLayer","_interopRequireDefault","_globeBackfaceCull","_enhancedTextBackgroundLayer","_globeView","_globeStarsLayer"],"sources":["../../../src/globe/index.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Globe mode layer adjustments.\n//\n// Globe-specific adjustments handled here:\n// - Grid / Hexagon aggregation cells on the globe: deck.gl 9.x's GridCellLayer /\n// HexagonCellLayer position cells in flat mercator common space and draw them with\n// project_common_position_to_clipspace, which leaves them on the XY plane through the\n// globe center rather than on its surface. ScaleEnhancedGridLayer /\n// ScaleEnhancedHexagonLayer swap in a globe-aware cell subclass (see\n// layer-utils/globe-cell-utils) that remaps each cell vertex from common space back to\n// lng/lat and onto the sphere.\n// - Text/Label rendering with back-face culling: MVTLabelLayer renders place labels via a\n// TextLayer whose glyph sublayer is EnhancedMultiIconLayer, which degenerates glyph\n// vertices on the far side of the globe so labels don't show through the planet.\n// User layer text labels reuse the same inject (see globe-backface-cull) and, when a\n// background is enabled, EnhancedTextBackgroundLayer — a copy of EnhancedMultiIconLayer\n// for the background sublayer. The GLSL itself is unchanged from EnhancedMultiIconLayer.\n\nexport {\n AtmosphereLayerRealistic,\n AtmosphereSkyLayerRealistic,\n AtmosphereHugeHaloLayer,\n getGlobeAtmosphereLayer,\n getGlobeAtmosphereSkyLayer,\n getGlobeHugeHaloLayer\n} from './atmosphere-layer';\nexport {GlobeDepthDiskLayer, getGlobeDepthDiskLayer} from './globe-depth-disk-layer';\nexport {\n getGlobeBaseLayers,\n getGlobeTopLayers,\n getGlobeClearColor,\n getGlobeBasemapAttributions,\n resolveGlobeBasemapProvider,\n DEFAULT_BASEMAP_COLOR,\n getBasemapColors,\n getBasemapColorsForStyle\n} from './globe-layers';\nexport type {GlobeBasemapProvider, GlobeAttribution} from './globe-layers';\nexport {MVTLabelLayer} from './mvt-label-layer';\nexport {default as EnhancedMultiIconLayer} from './enhanced-multi-icon-layer';\nexport {injectGlobeBackfaceCull} from './globe-backface-cull';\nexport {default as EnhancedTextBackgroundLayer} from './enhanced-text-background-layer';\nexport {KeplerGlobeView} from './globe-view';\nexport {getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground} from './globe-stars-layer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAAA,gBAAA,GAAAC,OAAA;AAQA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAWA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,4BAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA","ignoreList":[]}
|
|
@@ -141,6 +141,8 @@ var MVTLabelLayer = exports.MVTLabelLayer = /*#__PURE__*/function (_CompositeLay
|
|
|
141
141
|
// so explicitly disable culling here. depthTest off keeps labels on top of
|
|
142
142
|
// the globe surface rather than clipping into it.
|
|
143
143
|
cull: false,
|
|
144
|
+
// Override GlobeView's cullMode; legacy cull alone loses at draw time.
|
|
145
|
+
cullMode: 'none',
|
|
144
146
|
depthTest: false,
|
|
145
147
|
depthMask: false
|
|
146
148
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvt-label-layer.js","names":["_core","require","_layers","_enhancedMultiIconLayer","_interopRequireDefault","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","MVTLabelLayer","exports","_CompositeLayer","_classCallCheck2","_inherits2","_createClass2","key","value","getLabel","feature","properties","layerName","name_en","name","getLabelSize","getLabelAnchors","_ref","geometry","type","coordinates","updateState","_ref2","_this","changeFlags","data","props","dataChanged","features","labelData","flatMap","index","labelAnchors","map","p","getSubLayerRow","position","setState","renderLayers","_this$props","config","labelSizeUnits","labelBackground","billboard","layers","GeoJsonLayer","getSubLayerProps","id","updateTriggers","getFillColor","water","waterColor","getLineColor","adminLines","adminLinesColor","labels","TextLayer","state","parameters","cull","depthTest","depthMask","sizeUnits","characterSet","fontFamily","background","getBackgroundColor","getPosition","d","getText","getSubLayerAccessor","getSize","getColor","labelsColor","_subLayerProps","characters","EnhancedMultiIconLayer","CompositeLayer","defaultProps","optional"],"sources":["../../../src/globe/mvt-label-layer.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {\n CompositeLayer,\n Color,\n Layer,\n UpdateParameters,\n AccessorFunction,\n DefaultProps\n} from '@deck.gl/core';\nimport {GeoJsonLayer, TextLayer} from '@deck.gl/layers';\n\nimport type {Globe} from '@kepler.gl/constants';\nimport type {Feature} from 'geojson';\n\nimport EnhancedMultiIconLayer from './enhanced-multi-icon-layer';\n\n// Custom globe basemap label layer.\n//\n// This composite is used as the `renderSubLayers` of the globe basemap MVTLayer.\n// It renders two things per tile:\n// 1. A GeoJsonLayer for admin lines / water fills (same visuals as before).\n// 2. A TextLayer for place labels (country names), gated on `config.labels`.\n//\n// The TextLayer uses a custom `EnhancedMultiIconLayer` as its glyph (characters)\n// sublayer, which culls labels on the far side of the globe so they aren't drawn\n// through the planet.\n\ntype MVTLabelLayerProps = {\n data: {features: Feature[]} | Feature[];\n config: Globe['config'];\n labelSizeUnits?: 'meters' | 'common' | 'pixels';\n labelBackground?: Color;\n billboard?: boolean;\n};\n\nexport class MVTLabelLayer extends CompositeLayer<MVTLabelLayerProps> {\n static layerName = 'MVTLabelLayer';\n static defaultProps: DefaultProps = {\n ...GeoJsonLayer.defaultProps,\n billboard: true,\n labelSizeUnits: 'pixels',\n labelBackground: {type: 'color', value: null, optional: true},\n fontFamily: 'Monaco, monospace'\n };\n\n getLabel(feature: Feature): string {\n const {properties} = feature;\n\n switch (properties?.layerName) {\n // Mapbox `mapbox-streets-v8` schema.\n case 'place_label':\n switch (properties.class) {\n case 'country':\n return properties.name_en || properties.name || '';\n default:\n return '';\n }\n // CARTO / OpenMapTiles schema.\n case 'place':\n switch (properties.class) {\n case 'country':\n return properties['name:en'] || properties.name_en || properties.name || '';\n default:\n return '';\n }\n default:\n return '';\n }\n }\n\n getLabelSize(): number {\n return 10;\n }\n\n getLabelAnchors(feature: Feature): number[][] {\n // @ts-expect-error geometry type is narrowed by the switch below\n const {type, coordinates} = feature.geometry || {};\n switch (type) {\n case 'Point':\n return [coordinates];\n case 'MultiPoint':\n return coordinates;\n default:\n return [];\n }\n }\n\n updateState({changeFlags}: UpdateParameters<this>): void {\n const {data} = this.props;\n if (changeFlags.dataChanged && data) {\n const features = (data as {features: Feature[]}).features || (data as Feature[]);\n const labelData = (features || []).flatMap((feature, index) => {\n const labelAnchors = this.getLabelAnchors(feature);\n return labelAnchors.map(p => this.getSubLayerRow({position: p}, feature, index));\n });\n\n this.setState({labelData});\n }\n }\n\n renderLayers(): Layer[] {\n const {config, labelSizeUnits, labelBackground, billboard} = this.props;\n const layers: Layer[] = [];\n\n // admin lines and water\n layers.push(\n new GeoJsonLayer(this.props as any, this.getSubLayerProps({id: 'geojson'}), {\n data: this.props.data as any,\n updateTriggers: {\n getFillColor: {\n water: config.water,\n waterColor: config.waterColor\n },\n getLineColor: {\n adminLines: config.adminLines,\n adminLinesColor: config.adminLinesColor\n }\n }\n })\n );\n\n // labels\n if (config.labels) {\n layers.push(\n new TextLayer(this.getSubLayerProps({id: 'text'}), {\n data: this.state.labelData as any,\n parameters: {\n // Globe mode sets a global `cull: true` (to backface-cull the sphere\n // surface). That also backface-culls the glyph quads, hiding all labels,\n // so explicitly disable culling here. depthTest off keeps labels on top of\n // the globe surface rather than clipping into it.\n cull: false,\n depthTest: false,\n depthMask: false\n },\n billboard,\n sizeUnits: labelSizeUnits,\n // Build the font atlas from the actual labels so accented / non-ASCII\n // characters (ü, ó, etc. in country names) aren't dropped as \"missing\".\n characterSet: 'auto',\n fontFamily: 'Monaco, monospace',\n background: Boolean(labelBackground),\n getBackgroundColor: () => (labelBackground || [0, 0, 0, 0]) as Color,\n getPosition: (d: any) => d.position,\n getText: this.getSubLayerAccessor(this.getLabel) as AccessorFunction<Feature, string>,\n getSize: this.getSubLayerAccessor(this.getLabelSize),\n getColor: () => config.labelsColor as Color,\n _subLayerProps: {\n characters: {\n type: EnhancedMultiIconLayer\n }\n } as any,\n updateTriggers: {\n getColor: config.labelsColor\n }\n })\n );\n }\n\n return layers;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,uBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAiE,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,aAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,C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;EAC7Df,UAAU,EAAE;AAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"mvt-label-layer.js","names":["_core","require","_layers","_enhancedMultiIconLayer","_interopRequireDefault","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","MVTLabelLayer","exports","_CompositeLayer","_classCallCheck2","_inherits2","_createClass2","key","value","getLabel","feature","properties","layerName","name_en","name","getLabelSize","getLabelAnchors","_ref","geometry","type","coordinates","updateState","_ref2","_this","changeFlags","data","props","dataChanged","features","labelData","flatMap","index","labelAnchors","map","p","getSubLayerRow","position","setState","renderLayers","_this$props","config","labelSizeUnits","labelBackground","billboard","layers","GeoJsonLayer","getSubLayerProps","id","updateTriggers","getFillColor","water","waterColor","getLineColor","adminLines","adminLinesColor","labels","TextLayer","state","parameters","cull","cullMode","depthTest","depthMask","sizeUnits","characterSet","fontFamily","background","getBackgroundColor","getPosition","d","getText","getSubLayerAccessor","getSize","getColor","labelsColor","_subLayerProps","characters","EnhancedMultiIconLayer","CompositeLayer","defaultProps","optional"],"sources":["../../../src/globe/mvt-label-layer.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {\n CompositeLayer,\n Color,\n Layer,\n UpdateParameters,\n AccessorFunction,\n DefaultProps\n} from '@deck.gl/core';\nimport {GeoJsonLayer, TextLayer} from '@deck.gl/layers';\n\nimport type {Globe} from '@kepler.gl/constants';\nimport type {Feature} from 'geojson';\n\nimport EnhancedMultiIconLayer from './enhanced-multi-icon-layer';\n\n// Custom globe basemap label layer.\n//\n// This composite is used as the `renderSubLayers` of the globe basemap MVTLayer.\n// It renders two things per tile:\n// 1. A GeoJsonLayer for admin lines / water fills (same visuals as before).\n// 2. A TextLayer for place labels (country names), gated on `config.labels`.\n//\n// The TextLayer uses a custom `EnhancedMultiIconLayer` as its glyph (characters)\n// sublayer, which culls labels on the far side of the globe so they aren't drawn\n// through the planet.\n\ntype MVTLabelLayerProps = {\n data: {features: Feature[]} | Feature[];\n config: Globe['config'];\n labelSizeUnits?: 'meters' | 'common' | 'pixels';\n labelBackground?: Color;\n billboard?: boolean;\n};\n\nexport class MVTLabelLayer extends CompositeLayer<MVTLabelLayerProps> {\n static layerName = 'MVTLabelLayer';\n static defaultProps: DefaultProps = {\n ...GeoJsonLayer.defaultProps,\n billboard: true,\n labelSizeUnits: 'pixels',\n labelBackground: {type: 'color', value: null, optional: true},\n fontFamily: 'Monaco, monospace'\n };\n\n getLabel(feature: Feature): string {\n const {properties} = feature;\n\n switch (properties?.layerName) {\n // Mapbox `mapbox-streets-v8` schema.\n case 'place_label':\n switch (properties.class) {\n case 'country':\n return properties.name_en || properties.name || '';\n default:\n return '';\n }\n // CARTO / OpenMapTiles schema.\n case 'place':\n switch (properties.class) {\n case 'country':\n return properties['name:en'] || properties.name_en || properties.name || '';\n default:\n return '';\n }\n default:\n return '';\n }\n }\n\n getLabelSize(): number {\n return 10;\n }\n\n getLabelAnchors(feature: Feature): number[][] {\n // @ts-expect-error geometry type is narrowed by the switch below\n const {type, coordinates} = feature.geometry || {};\n switch (type) {\n case 'Point':\n return [coordinates];\n case 'MultiPoint':\n return coordinates;\n default:\n return [];\n }\n }\n\n updateState({changeFlags}: UpdateParameters<this>): void {\n const {data} = this.props;\n if (changeFlags.dataChanged && data) {\n const features = (data as {features: Feature[]}).features || (data as Feature[]);\n const labelData = (features || []).flatMap((feature, index) => {\n const labelAnchors = this.getLabelAnchors(feature);\n return labelAnchors.map(p => this.getSubLayerRow({position: p}, feature, index));\n });\n\n this.setState({labelData});\n }\n }\n\n renderLayers(): Layer[] {\n const {config, labelSizeUnits, labelBackground, billboard} = this.props;\n const layers: Layer[] = [];\n\n // admin lines and water\n layers.push(\n new GeoJsonLayer(this.props as any, this.getSubLayerProps({id: 'geojson'}), {\n data: this.props.data as any,\n updateTriggers: {\n getFillColor: {\n water: config.water,\n waterColor: config.waterColor\n },\n getLineColor: {\n adminLines: config.adminLines,\n adminLinesColor: config.adminLinesColor\n }\n }\n })\n );\n\n // labels\n if (config.labels) {\n layers.push(\n new TextLayer(this.getSubLayerProps({id: 'text'}), {\n data: this.state.labelData as any,\n parameters: {\n // Globe mode sets a global `cull: true` (to backface-cull the sphere\n // surface). That also backface-culls the glyph quads, hiding all labels,\n // so explicitly disable culling here. depthTest off keeps labels on top of\n // the globe surface rather than clipping into it.\n cull: false,\n // Override GlobeView's cullMode; legacy cull alone loses at draw time.\n cullMode: 'none',\n depthTest: false,\n depthMask: false\n },\n billboard,\n sizeUnits: labelSizeUnits,\n // Build the font atlas from the actual labels so accented / non-ASCII\n // characters (ü, ó, etc. in country names) aren't dropped as \"missing\".\n characterSet: 'auto',\n fontFamily: 'Monaco, monospace',\n background: Boolean(labelBackground),\n getBackgroundColor: () => (labelBackground || [0, 0, 0, 0]) as Color,\n getPosition: (d: any) => d.position,\n getText: this.getSubLayerAccessor(this.getLabel) as AccessorFunction<Feature, string>,\n getSize: this.getSubLayerAccessor(this.getLabelSize),\n getColor: () => config.labelsColor as Color,\n _subLayerProps: {\n characters: {\n type: EnhancedMultiIconLayer\n }\n } as any,\n updateTriggers: {\n getColor: config.labelsColor\n }\n })\n );\n }\n\n return layers;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,uBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAiE,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,G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AC9D,QAAQ,CAAsC;UACrF+D,OAAO,EAAE,IAAI,CAACD,mBAAmB,CAAC,IAAI,CAACxD,YAAY,CAAC;UACpD0D,QAAQ,EAAE,SAAVA,QAAQA,CAAA;YAAA,OAAQjC,MAAM,CAACkC,WAAW;UAAA,CAAS;UAC3CC,cAAc,EAAE;YACdC,UAAU,EAAE;cACVzD,IAAI,EAAE0D;YACR;UACF,CAAQ;UACR7B,cAAc,EAAE;YACdyB,QAAQ,EAAEjC,MAAM,CAACkC;UACnB;QACF,CAAC,CACH,CAAC;MACH;MAEA,OAAO9B,MAAM;IACf;EAAC;AAAA,EA/HgCkC,oBAAc;AAAA,IAAA5F,gBAAA,aAApCe,aAAa,eACL,eAAe;AAAA,IAAAf,gBAAA,aADvBe,aAAa,kBAAAnB,aAAA,CAAAA,aAAA,KAGnB+D,oBAAY,CAACkC,YAAY;EAC5BpC,SAAS,EAAE,IAAI;EACfF,cAAc,EAAE,QAAQ;EACxBC,eAAe,EAAE;IAACvB,IAAI,EAAE,OAAO;IAAEX,KAAK,EAAE,IAAI;IAAEwE,QAAQ,EAAE;EAAI,CAAC;EAC7Df,UAAU,EAAE;AAAmB","ignoreList":[]}
|
|
@@ -6,11 +6,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
|
|
7
7
|
// Back-face culling for globe-mode text labels.
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// original snippet; do not change the horizon formula here without treating it as a
|
|
12
|
-
// behavior change for every globe label that already uses EnhancedMultiIconLayer
|
|
13
|
-
// (including MVTLabelLayer basemap place names).
|
|
9
|
+
// Shared by the glyph and text-background sublayers, including MVTLabelLayer
|
|
10
|
+
// basemap place names.
|
|
14
11
|
//
|
|
15
12
|
// deck.gl's TextLayer uses a MultiIconLayer to render glyphs; on a globe, labels
|
|
16
13
|
// anchored on the far hemisphere would otherwise be drawn "through" the planet.
|
|
@@ -28,7 +25,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
28
25
|
// distance from the globe center.
|
|
29
26
|
// This is zoom-independent: the visible cap automatically shrinks as you zoom in and
|
|
30
27
|
// grows as you pull back, so labels don't pop in/out at the limb while zooming.
|
|
31
|
-
var BACKFACE_CULL_INJECT = /* glsl */"\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n //
|
|
28
|
+
var BACKFACE_CULL_INJECT = /* glsl */"\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n // Shrink the visible cap slightly to avoid glyphs smeared along the limb.\n // Scale the margin with the cap: a fixed +0.02 exceeds 1 as the camera\n // approaches the surface, incorrectly culling every label at city zooms.\n float cosHorizon = mix(radius / camDist, 1.0, 0.02);\n if (cosSurface < cosHorizon) {\n // Push the vertex outside clip space so this glyph is discarded. The hook\n // exposes the clip-space position as `position`, not `gl_Position`.\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n }\n";
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
31
|
* Appends the globe back-face cull snippet to a layer's vertex position hook,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globe-backface-cull.js","names":["BACKFACE_CULL_INJECT","injectGlobeBackfaceCull","shaders","_shaders$inject","existingRaw","inject","existing","injection","_objectSpread","concat"],"sources":["../../../src/globe/globe-backface-cull.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Back-face culling for globe-mode text labels.\n//\n//
|
|
1
|
+
{"version":3,"file":"globe-backface-cull.js","names":["BACKFACE_CULL_INJECT","injectGlobeBackfaceCull","shaders","_shaders$inject","existingRaw","inject","existing","injection","_objectSpread","concat"],"sources":["../../../src/globe/globe-backface-cull.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Back-face culling for globe-mode text labels.\n//\n// Shared by the glyph and text-background sublayers, including MVTLabelLayer\n// basemap place names.\n//\n// deck.gl's TextLayer uses a MultiIconLayer to render glyphs; on a globe, labels\n// anchored on the far hemisphere would otherwise be drawn \"through\" the planet.\n// This injects a small GLSL snippet into the vertex shader that degenerates\n// (collapses) glyph vertices whose anchor is facing away from the camera, so\n// back-side labels disappear.\n//\n// The test uses the true sphere-horizon condition rather than a fixed dot-product\n// cutoff. In deck.gl common space the globe is a sphere centered at the origin, so:\n// - the label anchor position doubles as its outward surface normal, and\n// - a surface point is visible from the camera exactly when the angle between its\n// normal and the camera direction is within the horizon half-angle, i.e.\n// dot(normalize(anchor), normalize(cameraPos)) > R / d\n// where R is the sphere radius (= |anchor|) and d = |cameraPos| is the camera\n// distance from the globe center.\n// This is zoom-independent: the visible cap automatically shrinks as you zoom in and\n// grows as you pull back, so labels don't pop in/out at the limb while zooming.\nconst BACKFACE_CULL_INJECT = /* glsl */ `\n // Only cull on the globe; leave web-mercator / flat views untouched.\n if (project.projectionMode == PROJECTION_MODE_GLOBE) {\n vec3 anchorCommon = geometry.position.xyz;\n float radius = length(anchorCommon);\n float camDist = length(project.cameraPosition);\n // Guard against degenerate anchors / camera at the center.\n if (radius > 0.0 && camDist > radius) {\n float cosSurface = dot(anchorCommon / radius, project.cameraPosition / camDist);\n // Shrink the visible cap slightly to avoid glyphs smeared along the limb.\n // Scale the margin with the cap: a fixed +0.02 exceeds 1 as the camera\n // approaches the surface, incorrectly culling every label at city zooms.\n float cosHorizon = mix(radius / camDist, 1.0, 0.02);\n if (cosSurface < cosHorizon) {\n // Push the vertex outside clip space so this glyph is discarded. The hook\n // exposes the clip-space position as \\`position\\`, not \\`gl_Position\\`.\n position = vec4(0.0, 0.0, 2.0, 1.0);\n }\n }\n }\n`;\n\n/**\n * Appends the globe back-face cull snippet to a layer's vertex position hook,\n * preserving anything the base layer already injected there.\n * Copied from EnhancedMultiIconLayer.getShaders().\n */\nexport function injectGlobeBackfaceCull(shaders: any): any {\n const existingRaw = shaders.inject?.['vs:DECKGL_FILTER_GL_POSITION'] || '';\n const existing = typeof existingRaw === 'string' ? existingRaw : existingRaw.injection || '';\n return {\n ...shaders,\n inject: {\n ...(shaders.inject || {}),\n 'vs:DECKGL_FILTER_GL_POSITION': `${existing}\\n${BACKFACE_CULL_INJECT}`\n }\n };\n}\n"],"mappings":";;;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,+hCAoB5B;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,OAAY,EAAO;EAAA,IAAAC,eAAA;EACzD,IAAMC,WAAW,GAAG,EAAAD,eAAA,GAAAD,OAAO,CAACG,MAAM,cAAAF,eAAA,uBAAdA,eAAA,CAAiB,8BAA8B,CAAC,KAAI,EAAE;EAC1E,IAAMG,QAAQ,GAAG,OAAOF,WAAW,KAAK,QAAQ,GAAGA,WAAW,GAAGA,WAAW,CAACG,SAAS,IAAI,EAAE;EAC5F,OAAAC,aAAA,CAAAA,aAAA,KACKN,OAAO;IACVG,MAAM,EAAAG,aAAA,CAAAA,aAAA,KACAN,OAAO,CAACG,MAAM,IAAI,CAAC,CAAC;MACxB,8BAA8B,KAAAI,MAAA,CAAKH,QAAQ,QAAAG,MAAA,CAAKT,oBAAoB;IAAE;EACvE;AAEL","ignoreList":[]}
|
package/dist/esm/globe/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { GlobeDepthDiskLayer, getGlobeDepthDiskLayer } from './globe-depth-disk-
|
|
|
23
23
|
export { getGlobeBaseLayers, getGlobeTopLayers, getGlobeClearColor, getGlobeBasemapAttributions, resolveGlobeBasemapProvider, DEFAULT_BASEMAP_COLOR, getBasemapColors, getBasemapColorsForStyle } from './globe-layers';
|
|
24
24
|
export { MVTLabelLayer } from './mvt-label-layer';
|
|
25
25
|
export { default as EnhancedMultiIconLayer } from './enhanced-multi-icon-layer';
|
|
26
|
+
export { injectGlobeBackfaceCull } from './globe-backface-cull';
|
|
26
27
|
export { default as EnhancedTextBackgroundLayer } from './enhanced-text-background-layer';
|
|
27
28
|
export { KeplerGlobeView } from './globe-view';
|
|
28
29
|
export { getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground } from './globe-stars-layer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["AtmosphereLayerRealistic","AtmosphereSkyLayerRealistic","AtmosphereHugeHaloLayer","getGlobeAtmosphereLayer","getGlobeAtmosphereSkyLayer","getGlobeHugeHaloLayer","GlobeDepthDiskLayer","getGlobeDepthDiskLayer","getGlobeBaseLayers","getGlobeTopLayers","getGlobeClearColor","getGlobeBasemapAttributions","resolveGlobeBasemapProvider","DEFAULT_BASEMAP_COLOR","getBasemapColors","getBasemapColorsForStyle","MVTLabelLayer","default","EnhancedMultiIconLayer","EnhancedTextBackgroundLayer","KeplerGlobeView","getStarsBackgroundImage","getStarsBackgroundStyle","drawStarsBackground"],"sources":["../../../src/globe/index.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Globe mode layer adjustments.\n//\n// Globe-specific adjustments handled here:\n// - Grid / Hexagon aggregation cells on the globe: deck.gl 9.x's GridCellLayer /\n// HexagonCellLayer position cells in flat mercator common space and draw them with\n// project_common_position_to_clipspace, which leaves them on the XY plane through the\n// globe center rather than on its surface. ScaleEnhancedGridLayer /\n// ScaleEnhancedHexagonLayer swap in a globe-aware cell subclass (see\n// layer-utils/globe-cell-utils) that remaps each cell vertex from common space back to\n// lng/lat and onto the sphere.\n// - Text/Label rendering with back-face culling: MVTLabelLayer renders place labels via a\n// TextLayer whose glyph sublayer is EnhancedMultiIconLayer, which degenerates glyph\n// vertices on the far side of the globe so labels don't show through the planet.\n// User layer text labels reuse the same inject (see globe-backface-cull) and, when a\n// background is enabled, EnhancedTextBackgroundLayer — a copy of EnhancedMultiIconLayer\n// for the background sublayer. The GLSL itself is unchanged from EnhancedMultiIconLayer.\n\nexport {\n AtmosphereLayerRealistic,\n AtmosphereSkyLayerRealistic,\n AtmosphereHugeHaloLayer,\n getGlobeAtmosphereLayer,\n getGlobeAtmosphereSkyLayer,\n getGlobeHugeHaloLayer\n} from './atmosphere-layer';\nexport {GlobeDepthDiskLayer, getGlobeDepthDiskLayer} from './globe-depth-disk-layer';\nexport {\n getGlobeBaseLayers,\n getGlobeTopLayers,\n getGlobeClearColor,\n getGlobeBasemapAttributions,\n resolveGlobeBasemapProvider,\n DEFAULT_BASEMAP_COLOR,\n getBasemapColors,\n getBasemapColorsForStyle\n} from './globe-layers';\nexport type {GlobeBasemapProvider, GlobeAttribution} from './globe-layers';\nexport {MVTLabelLayer} from './mvt-label-layer';\nexport {default as EnhancedMultiIconLayer} from './enhanced-multi-icon-layer';\nexport {default as EnhancedTextBackgroundLayer} from './enhanced-text-background-layer';\nexport {KeplerGlobeView} from './globe-view';\nexport {getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground} from './globe-stars-layer';\n"],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,wBAAwB,EACxBC,2BAA2B,EAC3BC,uBAAuB,EACvBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,qBAAqB,QAChB,oBAAoB;AAC3B,SAAQC,mBAAmB,EAAEC,sBAAsB,QAAO,0BAA0B;AACpF,SACEC,kBAAkB,EAClBC,iBAAiB,EACjBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,qBAAqB,EACrBC,gBAAgB,EAChBC,wBAAwB,QACnB,gBAAgB;AAEvB,SAAQC,aAAa,QAAO,mBAAmB;AAC/C,SAAQC,OAAO,IAAIC,sBAAsB,QAAO,6BAA6B;AAC7E,
|
|
1
|
+
{"version":3,"file":"index.js","names":["AtmosphereLayerRealistic","AtmosphereSkyLayerRealistic","AtmosphereHugeHaloLayer","getGlobeAtmosphereLayer","getGlobeAtmosphereSkyLayer","getGlobeHugeHaloLayer","GlobeDepthDiskLayer","getGlobeDepthDiskLayer","getGlobeBaseLayers","getGlobeTopLayers","getGlobeClearColor","getGlobeBasemapAttributions","resolveGlobeBasemapProvider","DEFAULT_BASEMAP_COLOR","getBasemapColors","getBasemapColorsForStyle","MVTLabelLayer","default","EnhancedMultiIconLayer","injectGlobeBackfaceCull","EnhancedTextBackgroundLayer","KeplerGlobeView","getStarsBackgroundImage","getStarsBackgroundStyle","drawStarsBackground"],"sources":["../../../src/globe/index.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\n// Globe mode layer adjustments.\n//\n// Globe-specific adjustments handled here:\n// - Grid / Hexagon aggregation cells on the globe: deck.gl 9.x's GridCellLayer /\n// HexagonCellLayer position cells in flat mercator common space and draw them with\n// project_common_position_to_clipspace, which leaves them on the XY plane through the\n// globe center rather than on its surface. ScaleEnhancedGridLayer /\n// ScaleEnhancedHexagonLayer swap in a globe-aware cell subclass (see\n// layer-utils/globe-cell-utils) that remaps each cell vertex from common space back to\n// lng/lat and onto the sphere.\n// - Text/Label rendering with back-face culling: MVTLabelLayer renders place labels via a\n// TextLayer whose glyph sublayer is EnhancedMultiIconLayer, which degenerates glyph\n// vertices on the far side of the globe so labels don't show through the planet.\n// User layer text labels reuse the same inject (see globe-backface-cull) and, when a\n// background is enabled, EnhancedTextBackgroundLayer — a copy of EnhancedMultiIconLayer\n// for the background sublayer. The GLSL itself is unchanged from EnhancedMultiIconLayer.\n\nexport {\n AtmosphereLayerRealistic,\n AtmosphereSkyLayerRealistic,\n AtmosphereHugeHaloLayer,\n getGlobeAtmosphereLayer,\n getGlobeAtmosphereSkyLayer,\n getGlobeHugeHaloLayer\n} from './atmosphere-layer';\nexport {GlobeDepthDiskLayer, getGlobeDepthDiskLayer} from './globe-depth-disk-layer';\nexport {\n getGlobeBaseLayers,\n getGlobeTopLayers,\n getGlobeClearColor,\n getGlobeBasemapAttributions,\n resolveGlobeBasemapProvider,\n DEFAULT_BASEMAP_COLOR,\n getBasemapColors,\n getBasemapColorsForStyle\n} from './globe-layers';\nexport type {GlobeBasemapProvider, GlobeAttribution} from './globe-layers';\nexport {MVTLabelLayer} from './mvt-label-layer';\nexport {default as EnhancedMultiIconLayer} from './enhanced-multi-icon-layer';\nexport {injectGlobeBackfaceCull} from './globe-backface-cull';\nexport {default as EnhancedTextBackgroundLayer} from './enhanced-text-background-layer';\nexport {KeplerGlobeView} from './globe-view';\nexport {getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground} from './globe-stars-layer';\n"],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,wBAAwB,EACxBC,2BAA2B,EAC3BC,uBAAuB,EACvBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,qBAAqB,QAChB,oBAAoB;AAC3B,SAAQC,mBAAmB,EAAEC,sBAAsB,QAAO,0BAA0B;AACpF,SACEC,kBAAkB,EAClBC,iBAAiB,EACjBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,qBAAqB,EACrBC,gBAAgB,EAChBC,wBAAwB,QACnB,gBAAgB;AAEvB,SAAQC,aAAa,QAAO,mBAAmB;AAC/C,SAAQC,OAAO,IAAIC,sBAAsB,QAAO,6BAA6B;AAC7E,SAAQC,uBAAuB,QAAO,uBAAuB;AAC7D,SAAQF,OAAO,IAAIG,2BAA2B,QAAO,kCAAkC;AACvF,SAAQC,eAAe,QAAO,cAAc;AAC5C,SAAQC,uBAAuB,EAAEC,uBAAuB,EAAEC,mBAAmB,QAAO,qBAAqB","ignoreList":[]}
|
|
@@ -138,6 +138,8 @@ export var MVTLabelLayer = /*#__PURE__*/function (_CompositeLayer) {
|
|
|
138
138
|
// so explicitly disable culling here. depthTest off keeps labels on top of
|
|
139
139
|
// the globe surface rather than clipping into it.
|
|
140
140
|
cull: false,
|
|
141
|
+
// Override GlobeView's cullMode; legacy cull alone loses at draw time.
|
|
142
|
+
cullMode: 'none',
|
|
141
143
|
depthTest: false,
|
|
142
144
|
depthMask: false
|
|
143
145
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvt-label-layer.js","names":["CompositeLayer","GeoJsonLayer","TextLayer","EnhancedMultiIconLayer","MVTLabelLayer","_CompositeLayer","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","getLabel","feature","properties","layerName","name_en","name","getLabelSize","getLabelAnchors","_ref","geometry","type","coordinates","updateState","_ref2","_this","changeFlags","data","props","dataChanged","features","labelData","flatMap","index","labelAnchors","map","p","getSubLayerRow","position","setState","renderLayers","_this$props","config","labelSizeUnits","labelBackground","billboard","layers","push","getSubLayerProps","id","updateTriggers","getFillColor","water","waterColor","getLineColor","adminLines","adminLinesColor","labels","state","parameters","cull","depthTest","depthMask","sizeUnits","characterSet","fontFamily","background","Boolean","getBackgroundColor","getPosition","d","getText","getSubLayerAccessor","getSize","getColor","labelsColor","_subLayerProps","characters","_defineProperty","_objectSpread","defaultProps","optional"],"sources":["../../../src/globe/mvt-label-layer.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {\n CompositeLayer,\n Color,\n Layer,\n UpdateParameters,\n AccessorFunction,\n DefaultProps\n} from '@deck.gl/core';\nimport {GeoJsonLayer, TextLayer} from '@deck.gl/layers';\n\nimport type {Globe} from '@kepler.gl/constants';\nimport type {Feature} from 'geojson';\n\nimport EnhancedMultiIconLayer from './enhanced-multi-icon-layer';\n\n// Custom globe basemap label layer.\n//\n// This composite is used as the `renderSubLayers` of the globe basemap MVTLayer.\n// It renders two things per tile:\n// 1. A GeoJsonLayer for admin lines / water fills (same visuals as before).\n// 2. A TextLayer for place labels (country names), gated on `config.labels`.\n//\n// The TextLayer uses a custom `EnhancedMultiIconLayer` as its glyph (characters)\n// sublayer, which culls labels on the far side of the globe so they aren't drawn\n// through the planet.\n\ntype MVTLabelLayerProps = {\n data: {features: Feature[]} | Feature[];\n config: Globe['config'];\n labelSizeUnits?: 'meters' | 'common' | 'pixels';\n labelBackground?: Color;\n billboard?: boolean;\n};\n\nexport class MVTLabelLayer extends CompositeLayer<MVTLabelLayerProps> {\n static layerName = 'MVTLabelLayer';\n static defaultProps: DefaultProps = {\n ...GeoJsonLayer.defaultProps,\n billboard: true,\n labelSizeUnits: 'pixels',\n labelBackground: {type: 'color', value: null, optional: true},\n fontFamily: 'Monaco, monospace'\n };\n\n getLabel(feature: Feature): string {\n const {properties} = feature;\n\n switch (properties?.layerName) {\n // Mapbox `mapbox-streets-v8` schema.\n case 'place_label':\n switch (properties.class) {\n case 'country':\n return properties.name_en || properties.name || '';\n default:\n return '';\n }\n // CARTO / OpenMapTiles schema.\n case 'place':\n switch (properties.class) {\n case 'country':\n return properties['name:en'] || properties.name_en || properties.name || '';\n default:\n return '';\n }\n default:\n return '';\n }\n }\n\n getLabelSize(): number {\n return 10;\n }\n\n getLabelAnchors(feature: Feature): number[][] {\n // @ts-expect-error geometry type is narrowed by the switch below\n const {type, coordinates} = feature.geometry || {};\n switch (type) {\n case 'Point':\n return [coordinates];\n case 'MultiPoint':\n return coordinates;\n default:\n return [];\n }\n }\n\n updateState({changeFlags}: UpdateParameters<this>): void {\n const {data} = this.props;\n if (changeFlags.dataChanged && data) {\n const features = (data as {features: Feature[]}).features || (data as Feature[]);\n const labelData = (features || []).flatMap((feature, index) => {\n const labelAnchors = this.getLabelAnchors(feature);\n return labelAnchors.map(p => this.getSubLayerRow({position: p}, feature, index));\n });\n\n this.setState({labelData});\n }\n }\n\n renderLayers(): Layer[] {\n const {config, labelSizeUnits, labelBackground, billboard} = this.props;\n const layers: Layer[] = [];\n\n // admin lines and water\n layers.push(\n new GeoJsonLayer(this.props as any, this.getSubLayerProps({id: 'geojson'}), {\n data: this.props.data as any,\n updateTriggers: {\n getFillColor: {\n water: config.water,\n waterColor: config.waterColor\n },\n getLineColor: {\n adminLines: config.adminLines,\n adminLinesColor: config.adminLinesColor\n }\n }\n })\n );\n\n // labels\n if (config.labels) {\n layers.push(\n new TextLayer(this.getSubLayerProps({id: 'text'}), {\n data: this.state.labelData as any,\n parameters: {\n // Globe mode sets a global `cull: true` (to backface-cull the sphere\n // surface). That also backface-culls the glyph quads, hiding all labels,\n // so explicitly disable culling here. depthTest off keeps labels on top of\n // the globe surface rather than clipping into it.\n cull: false,\n depthTest: false,\n depthMask: false\n },\n billboard,\n sizeUnits: labelSizeUnits,\n // Build the font atlas from the actual labels so accented / non-ASCII\n // characters (ü, ó, etc. in country names) aren't dropped as \"missing\".\n characterSet: 'auto',\n fontFamily: 'Monaco, monospace',\n background: Boolean(labelBackground),\n getBackgroundColor: () => (labelBackground || [0, 0, 0, 0]) as Color,\n getPosition: (d: any) => d.position,\n getText: this.getSubLayerAccessor(this.getLabel) as AccessorFunction<Feature, string>,\n getSize: this.getSubLayerAccessor(this.getLabelSize),\n getColor: () => config.labelsColor as Color,\n _subLayerProps: {\n characters: {\n type: EnhancedMultiIconLayer\n }\n } as any,\n updateTriggers: {\n getColor: config.labelsColor\n }\n })\n );\n }\n\n return layers;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;;AAEA,SACEA,cAAc,QAMT,eAAe;AACtB,SAAQC,YAAY,EAAEC,SAA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AAE,SAAVA,QAAQA,CAAA;YAAA,OAAQhC,MAAM,CAACiC,WAAW;UAAA,CAAS;UAC3CC,cAAc,EAAE;YACdC,UAAU,EAAE;cACVxD,IAAI,EAAEpB;YACR;UACF,CAAQ;UACRiD,cAAc,EAAE;YACdwB,QAAQ,EAAEhC,MAAM,CAACiC;UACnB;QACF,CAAC,CACH,CAAC;MACH;MAEA,OAAO7B,MAAM;IACf;EAAC;AAAA,EA7HgChD,cAAc;AA8HhDgF,eAAA,CA9HY5E,aAAa,eACL,eAAe;AAAA4E,eAAA,CADvB5E,aAAa,kBAAA6E,aAAA,CAAAA,aAAA,KAGnBhF,YAAY,CAACiF,YAAY;EAC5BnC,SAAS,EAAE,IAAI;EACfF,cAAc,EAAE,QAAQ;EACxBC,eAAe,EAAE;IAACvB,IAAI,EAAE,OAAO;IAAEX,KAAK,EAAE,IAAI;IAAEuE,QAAQ,EAAE;EAAI,CAAC;EAC7DhB,UAAU,EAAE;AAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"mvt-label-layer.js","names":["CompositeLayer","GeoJsonLayer","TextLayer","EnhancedMultiIconLayer","MVTLabelLayer","_CompositeLayer","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","getLabel","feature","properties","layerName","name_en","name","getLabelSize","getLabelAnchors","_ref","geometry","type","coordinates","updateState","_ref2","_this","changeFlags","data","props","dataChanged","features","labelData","flatMap","index","labelAnchors","map","p","getSubLayerRow","position","setState","renderLayers","_this$props","config","labelSizeUnits","labelBackground","billboard","layers","push","getSubLayerProps","id","updateTriggers","getFillColor","water","waterColor","getLineColor","adminLines","adminLinesColor","labels","state","parameters","cull","cullMode","depthTest","depthMask","sizeUnits","characterSet","fontFamily","background","Boolean","getBackgroundColor","getPosition","d","getText","getSubLayerAccessor","getSize","getColor","labelsColor","_subLayerProps","characters","_defineProperty","_objectSpread","defaultProps","optional"],"sources":["../../../src/globe/mvt-label-layer.ts"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// Copyright contributors to the kepler.gl project\n\nimport {\n CompositeLayer,\n Color,\n Layer,\n UpdateParameters,\n AccessorFunction,\n DefaultProps\n} from '@deck.gl/core';\nimport {GeoJsonLayer, TextLayer} from '@deck.gl/layers';\n\nimport type {Globe} from '@kepler.gl/constants';\nimport type {Feature} from 'geojson';\n\nimport EnhancedMultiIconLayer from './enhanced-multi-icon-layer';\n\n// Custom globe basemap label layer.\n//\n// This composite is used as the `renderSubLayers` of the globe basemap MVTLayer.\n// It renders two things per tile:\n// 1. A GeoJsonLayer for admin lines / water fills (same visuals as before).\n// 2. A TextLayer for place labels (country names), gated on `config.labels`.\n//\n// The TextLayer uses a custom `EnhancedMultiIconLayer` as its glyph (characters)\n// sublayer, which culls labels on the far side of the globe so they aren't drawn\n// through the planet.\n\ntype MVTLabelLayerProps = {\n data: {features: Feature[]} | Feature[];\n config: Globe['config'];\n labelSizeUnits?: 'meters' | 'common' | 'pixels';\n labelBackground?: Color;\n billboard?: boolean;\n};\n\nexport class MVTLabelLayer extends CompositeLayer<MVTLabelLayerProps> {\n static layerName = 'MVTLabelLayer';\n static defaultProps: DefaultProps = {\n ...GeoJsonLayer.defaultProps,\n billboard: true,\n labelSizeUnits: 'pixels',\n labelBackground: {type: 'color', value: null, optional: true},\n fontFamily: 'Monaco, monospace'\n };\n\n getLabel(feature: Feature): string {\n const {properties} = feature;\n\n switch (properties?.layerName) {\n // Mapbox `mapbox-streets-v8` schema.\n case 'place_label':\n switch (properties.class) {\n case 'country':\n return properties.name_en || properties.name || '';\n default:\n return '';\n }\n // CARTO / OpenMapTiles schema.\n case 'place':\n switch (properties.class) {\n case 'country':\n return properties['name:en'] || properties.name_en || properties.name || '';\n default:\n return '';\n }\n default:\n return '';\n }\n }\n\n getLabelSize(): number {\n return 10;\n }\n\n getLabelAnchors(feature: Feature): number[][] {\n // @ts-expect-error geometry type is narrowed by the switch below\n const {type, coordinates} = feature.geometry || {};\n switch (type) {\n case 'Point':\n return [coordinates];\n case 'MultiPoint':\n return coordinates;\n default:\n return [];\n }\n }\n\n updateState({changeFlags}: UpdateParameters<this>): void {\n const {data} = this.props;\n if (changeFlags.dataChanged && data) {\n const features = (data as {features: Feature[]}).features || (data as Feature[]);\n const labelData = (features || []).flatMap((feature, index) => {\n const labelAnchors = this.getLabelAnchors(feature);\n return labelAnchors.map(p => this.getSubLayerRow({position: p}, feature, index));\n });\n\n this.setState({labelData});\n }\n }\n\n renderLayers(): Layer[] {\n const {config, labelSizeUnits, labelBackground, billboard} = this.props;\n const layers: Layer[] = [];\n\n // admin lines and water\n layers.push(\n new GeoJsonLayer(this.props as any, this.getSubLayerProps({id: 'geojson'}), {\n data: this.props.data as any,\n updateTriggers: {\n getFillColor: {\n water: config.water,\n waterColor: config.waterColor\n },\n getLineColor: {\n adminLines: config.adminLines,\n adminLinesColor: config.adminLinesColor\n }\n }\n })\n );\n\n // labels\n if (config.labels) {\n layers.push(\n new TextLayer(this.getSubLayerProps({id: 'text'}), {\n data: this.state.labelData as any,\n parameters: {\n // Globe mode sets a global `cull: true` (to backface-cull the sphere\n // surface). That also backface-culls the glyph quads, hiding all labels,\n // so explicitly disable culling here. depthTest off keeps labels on top of\n // the globe surface rather than clipping into it.\n cull: false,\n // Override GlobeView's cullMode; legacy cull alone loses at draw time.\n cullMode: 'none',\n depthTest: false,\n depthMask: false\n },\n billboard,\n sizeUnits: labelSizeUnits,\n // Build the font atlas from the actual labels so accented / non-ASCII\n // characters (ü, ó, etc. in country names) aren't dropped as \"missing\".\n characterSet: 'auto',\n fontFamily: 'Monaco, monospace',\n background: Boolean(labelBackground),\n getBackgroundColor: () => (labelBackground || [0, 0, 0, 0]) as Color,\n getPosition: (d: any) => d.position,\n getText: this.getSubLayerAccessor(this.getLabel) as AccessorFunction<Feature, string>,\n getSize: this.getSubLayerAccessor(this.getLabelSize),\n getColor: () => config.labelsColor as Color,\n _subLayerProps: {\n characters: {\n type: EnhancedMultiIconLayer\n }\n } as any,\n updateTriggers: {\n getColor: config.labelsColor\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AAO,EAAE,IAAI,CAACC,mBAAmB,CAAC,IAAI,CAAC9D,QAAQ,CAAsC;UACrF+D,OAAO,EAAE,IAAI,CAACD,mBAAmB,CAAC,IAAI,CAACxD,YAAY,CAAC;UACpD0D,QAAQ,EAAE,SAAVA,QAAQA,CAAA;YAAA,OAAQjC,MAAM,CAACkC,WAAW;UAAA,CAAS;UAC3CC,cAAc,EAAE;YACdC,UAAU,EAAE;cACVzD,IAAI,EAAEpB;YACR;UACF,CAAQ;UACRiD,cAAc,EAAE;YACdyB,QAAQ,EAAEjC,MAAM,CAACkC;UACnB;QACF,CAAC,CACH,CAAC;MACH;MAEA,OAAO9B,MAAM;IACf;EAAC;AAAA,EA/HgChD,cAAc;AAgIhDiF,eAAA,CAhIY7E,aAAa,eACL,eAAe;AAAA6E,eAAA,CADvB7E,aAAa,kBAAA8E,aAAA,CAAAA,aAAA,KAGnBjF,YAAY,CAACkF,YAAY;EAC5BpC,SAAS,EAAE,IAAI;EACfF,cAAc,EAAE,QAAQ;EACxBC,eAAe,EAAE;IAACvB,IAAI,EAAE,OAAO;IAAEX,KAAK,EAAE,IAAI;IAAEwE,QAAQ,EAAE;EAAI,CAAC;EAC7DhB,UAAU,EAAE;AAAmB","ignoreList":[]}
|
package/dist/globe/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { getGlobeBaseLayers, getGlobeTopLayers, getGlobeClearColor, getGlobeBase
|
|
|
4
4
|
export type { GlobeBasemapProvider, GlobeAttribution } from './globe-layers';
|
|
5
5
|
export { MVTLabelLayer } from './mvt-label-layer';
|
|
6
6
|
export { default as EnhancedMultiIconLayer } from './enhanced-multi-icon-layer';
|
|
7
|
+
export { injectGlobeBackfaceCull } from './globe-backface-cull';
|
|
7
8
|
export { default as EnhancedTextBackgroundLayer } from './enhanced-text-background-layer';
|
|
8
9
|
export { KeplerGlobeView } from './globe-view';
|
|
9
10
|
export { getStarsBackgroundImage, getStarsBackgroundStyle, drawStarsBackground } from './globe-stars-layer';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kepler.gl/deckgl-layers",
|
|
3
3
|
"author": "Shan He <shan@uber.com>",
|
|
4
|
-
"version": "3.3.0-alpha.
|
|
4
|
+
"version": "3.3.0-alpha.25",
|
|
5
5
|
"description": "kepler.gl constants used by kepler.gl components, actions and reducers",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@deck.gl/geo-layers": "^9.4.1",
|
|
34
34
|
"@deck.gl/layers": "^9.4.1",
|
|
35
35
|
"@deck.gl/mesh-layers": "^9.4.1",
|
|
36
|
-
"@kepler.gl/constants": "3.3.0-alpha.
|
|
37
|
-
"@kepler.gl/types": "3.3.0-alpha.
|
|
38
|
-
"@kepler.gl/utils": "3.3.0-alpha.
|
|
36
|
+
"@kepler.gl/constants": "3.3.0-alpha.25",
|
|
37
|
+
"@kepler.gl/types": "3.3.0-alpha.25",
|
|
38
|
+
"@kepler.gl/utils": "3.3.0-alpha.25",
|
|
39
39
|
"@loaders.gl/wms": "4.4.5",
|
|
40
40
|
"@luma.gl/constants": "^9.4.2",
|
|
41
41
|
"@luma.gl/core": "^9.4.2",
|