@treasuryspatial/map-kit 0.1.5 → 0.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mapThreeLayer.d.ts","sourceRoot":"","sources":["../src/mapThreeLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA+OhF"}
1
+ {"version":3,"file":"mapThreeLayer.d.ts","sourceRoot":"","sources":["../src/mapThreeLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC;IACrC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAgRhF"}
@@ -66,6 +66,22 @@ export function createMapThreeLayer(options) {
66
66
  }
67
67
  });
68
68
  hasRenderable = found;
69
+ if (debug && found) {
70
+ try {
71
+ group.updateWorldMatrix(true, true);
72
+ const box = new THREE.Box3().setFromObject(group);
73
+ const size = new THREE.Vector3();
74
+ box.getSize(size);
75
+ log('group bounds', {
76
+ min: { x: box.min.x, y: box.min.y, z: box.min.z },
77
+ max: { x: box.max.x, y: box.max.y, z: box.max.z },
78
+ size: { x: size.x, y: size.y, z: size.z },
79
+ });
80
+ }
81
+ catch (err) {
82
+ logError('failed to compute group bounds', err);
83
+ }
84
+ }
69
85
  };
70
86
  const layer = {
71
87
  id,
@@ -80,6 +96,8 @@ export function createMapThreeLayer(options) {
80
96
  context: gl,
81
97
  antialias: true,
82
98
  logarithmicDepthBuffer: true,
99
+ alpha: true,
100
+ premultipliedAlpha: true,
83
101
  });
84
102
  renderer.autoClear = false;
85
103
  renderer.outputColorSpace = THREE.SRGBColorSpace;
@@ -138,10 +156,16 @@ export function createMapThreeLayer(options) {
138
156
  log('renderTarget resized', { width: targetWidth, height: targetHeight });
139
157
  }
140
158
  renderer.setRenderTarget(renderTarget);
159
+ renderer.resetState();
160
+ const gl = renderer.getContext();
161
+ gl.disable(gl.SCISSOR_TEST);
162
+ gl.disable(gl.STENCIL_TEST);
163
+ gl.colorMask(true, true, true, true);
164
+ gl.depthMask(true);
165
+ renderer.setViewport(0, 0, targetWidth, targetHeight);
141
166
  renderer.setClearColor(0x000000, 0);
142
167
  renderer.setClearAlpha(0);
143
168
  renderer.clear(true, true, true);
144
- const gl = renderer.getContext();
145
169
  checkFramebuffer(gl, 'prerender');
146
170
  renderer.render(scene, camera);
147
171
  logGlError(gl, 'prerender');
@@ -208,10 +232,20 @@ export function createMapThreeLayer(options) {
208
232
  setOrigin: (origin) => {
209
233
  if (!origin) {
210
234
  mercatorOrigin = null;
235
+ if (debug) {
236
+ log('origin cleared');
237
+ }
211
238
  return;
212
239
  }
213
240
  mercatorOrigin = mapboxgl.MercatorCoordinate.fromLngLat(origin);
214
241
  meterScale = mercatorOrigin.meterInMercatorCoordinateUnits();
242
+ if (debug) {
243
+ log('origin set', {
244
+ origin,
245
+ mercator: { x: mercatorOrigin.x, y: mercatorOrigin.y, z: mercatorOrigin.z },
246
+ meterScale,
247
+ });
248
+ }
215
249
  },
216
250
  setZOffsetMeters: (offset) => {
217
251
  zOffset = offset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treasuryspatial/map-kit",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/index.js",