@project-skymap/library 0.7.2 → 0.7.3

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/index.js CHANGED
@@ -316,6 +316,10 @@ var BLEND_CHUNK, MASK_CHUNK;
316
316
  var init_shaders = __esm({
317
317
  "src/engine/shaders.ts"() {
318
318
  BLEND_CHUNK = `
319
+ #ifdef GL_ES
320
+ precision highp float;
321
+ #endif
322
+
319
323
  uniform float uScale;
320
324
  uniform float uAspect;
321
325
  uniform float uBlend;
@@ -360,6 +364,10 @@ vec4 smartProject(vec4 viewPos) {
360
364
  }
361
365
  `;
362
366
  MASK_CHUNK = `
367
+ #ifdef GL_ES
368
+ precision highp float;
369
+ #endif
370
+
363
371
  uniform float uAspect;
364
372
  uniform float uBlend;
365
373
  uniform int uProjectionType;
@@ -425,10 +433,12 @@ var init_ConstellationArtworkLayer = __esm({
425
433
  ConstellationArtworkLayer = class {
426
434
  root;
427
435
  items = [];
428
- textureLoader = new THREE5.TextureLoader();
436
+ textureLoader;
429
437
  hoveredId = null;
430
438
  focusedId = null;
431
439
  constructor(root) {
440
+ this.textureLoader = new THREE5.TextureLoader();
441
+ this.textureLoader.crossOrigin = "anonymous";
432
442
  this.root = new THREE5.Group();
433
443
  this.root.renderOrder = -1;
434
444
  root.add(this.root);
@@ -519,12 +529,16 @@ var init_ConstellationArtworkLayer = __esm({
519
529
  // uScale, uAspect (screen) are injected by createSmartMaterial/globalUniforms
520
530
  },
521
531
  vertexShaderBody: `
532
+ #ifdef GL_ES
533
+ precision highp float;
534
+ #endif
535
+
522
536
  uniform float uSize;
523
537
  uniform float uImgRotation;
524
538
  uniform float uImgAspect;
525
-
539
+
526
540
  varying vec2 vUv;
527
-
541
+
528
542
  void main() {
529
543
  vUv = uv;
530
544
 
@@ -578,6 +592,9 @@ var init_ConstellationArtworkLayer = __esm({
578
592
  }
579
593
  `,
580
594
  fragmentShader: `
595
+ #ifdef GL_ES
596
+ precision highp float;
597
+ #endif
581
598
  uniform sampler2D uMap;
582
599
  uniform float uOpacity;
583
600
  varying vec2 vUv;
@@ -594,12 +611,23 @@ var init_ConstellationArtworkLayer = __esm({
594
611
  blending,
595
612
  side: THREE5.DoubleSide
596
613
  });
597
- material.uniforms.uMap.value = this.textureLoader.load(texPath, (tex) => {
598
- if (c.aspectRatio === void 0 && tex.image.width && tex.image.height) {
599
- const natAspect = tex.image.width / tex.image.height;
600
- material.uniforms.uImgAspect.value = natAspect;
614
+ material.uniforms.uMap.value = this.textureLoader.load(
615
+ texPath,
616
+ (tex) => {
617
+ tex.minFilter = THREE5.LinearFilter;
618
+ tex.magFilter = THREE5.LinearFilter;
619
+ tex.generateMipmaps = false;
620
+ tex.needsUpdate = true;
621
+ if (c.aspectRatio === void 0 && tex.image.width && tex.image.height) {
622
+ const natAspect = tex.image.width / tex.image.height;
623
+ material.uniforms.uImgAspect.value = natAspect;
624
+ }
625
+ },
626
+ void 0,
627
+ (err) => {
628
+ console.warn(`Failed to load constellation texture: ${texPath}`, err);
601
629
  }
602
- });
630
+ );
603
631
  if (c.zBias) {
604
632
  material.polygonOffset = true;
605
633
  material.polygonOffsetFactor = -c.zBias;
@@ -2493,9 +2521,19 @@ function createEngine({
2493
2521
  const t1 = touches[1];
2494
2522
  const newDistance = getTouchDistance(t0, t1);
2495
2523
  const scale = newDistance / state.pinchStartDistance;
2524
+ const prevFov = state.fov;
2496
2525
  state.fov = state.pinchStartFov / scale;
2497
2526
  state.fov = Math.max(ENGINE_CONFIG.minFov, Math.min(ENGINE_CONFIG.maxFov, state.fov));
2498
2527
  handlers.onFovChange?.(state.fov);
2528
+ if (state.fov > prevFov && state.fov > ENGINE_CONFIG.zenithStartFov) {
2529
+ const range = ENGINE_CONFIG.maxFov - ENGINE_CONFIG.zenithStartFov;
2530
+ let t = (state.fov - ENGINE_CONFIG.zenithStartFov) / range;
2531
+ t = Math.max(0, Math.min(1, t));
2532
+ const bias = ENGINE_CONFIG.zenithStrength * t;
2533
+ const zenithLat = Math.PI / 2 - 1e-3;
2534
+ state.lat = state.lat * (1 - bias) + zenithLat * bias;
2535
+ state.targetLat = state.lat;
2536
+ }
2499
2537
  const center = getTouchCenter(t0, t1);
2500
2538
  const deltaX = center.x - state.lastMouseX;
2501
2539
  const deltaY = center.y - state.lastMouseY;