@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.cjs CHANGED
@@ -338,6 +338,10 @@ var BLEND_CHUNK, MASK_CHUNK;
338
338
  var init_shaders = __esm({
339
339
  "src/engine/shaders.ts"() {
340
340
  BLEND_CHUNK = `
341
+ #ifdef GL_ES
342
+ precision highp float;
343
+ #endif
344
+
341
345
  uniform float uScale;
342
346
  uniform float uAspect;
343
347
  uniform float uBlend;
@@ -382,6 +386,10 @@ vec4 smartProject(vec4 viewPos) {
382
386
  }
383
387
  `;
384
388
  MASK_CHUNK = `
389
+ #ifdef GL_ES
390
+ precision highp float;
391
+ #endif
392
+
385
393
  uniform float uAspect;
386
394
  uniform float uBlend;
387
395
  uniform int uProjectionType;
@@ -447,10 +455,12 @@ var init_ConstellationArtworkLayer = __esm({
447
455
  ConstellationArtworkLayer = class {
448
456
  root;
449
457
  items = [];
450
- textureLoader = new THREE5__namespace.TextureLoader();
458
+ textureLoader;
451
459
  hoveredId = null;
452
460
  focusedId = null;
453
461
  constructor(root) {
462
+ this.textureLoader = new THREE5__namespace.TextureLoader();
463
+ this.textureLoader.crossOrigin = "anonymous";
454
464
  this.root = new THREE5__namespace.Group();
455
465
  this.root.renderOrder = -1;
456
466
  root.add(this.root);
@@ -541,12 +551,16 @@ var init_ConstellationArtworkLayer = __esm({
541
551
  // uScale, uAspect (screen) are injected by createSmartMaterial/globalUniforms
542
552
  },
543
553
  vertexShaderBody: `
554
+ #ifdef GL_ES
555
+ precision highp float;
556
+ #endif
557
+
544
558
  uniform float uSize;
545
559
  uniform float uImgRotation;
546
560
  uniform float uImgAspect;
547
-
561
+
548
562
  varying vec2 vUv;
549
-
563
+
550
564
  void main() {
551
565
  vUv = uv;
552
566
 
@@ -600,6 +614,9 @@ var init_ConstellationArtworkLayer = __esm({
600
614
  }
601
615
  `,
602
616
  fragmentShader: `
617
+ #ifdef GL_ES
618
+ precision highp float;
619
+ #endif
603
620
  uniform sampler2D uMap;
604
621
  uniform float uOpacity;
605
622
  varying vec2 vUv;
@@ -616,12 +633,23 @@ var init_ConstellationArtworkLayer = __esm({
616
633
  blending,
617
634
  side: THREE5__namespace.DoubleSide
618
635
  });
619
- material.uniforms.uMap.value = this.textureLoader.load(texPath, (tex) => {
620
- if (c.aspectRatio === void 0 && tex.image.width && tex.image.height) {
621
- const natAspect = tex.image.width / tex.image.height;
622
- material.uniforms.uImgAspect.value = natAspect;
636
+ material.uniforms.uMap.value = this.textureLoader.load(
637
+ texPath,
638
+ (tex) => {
639
+ tex.minFilter = THREE5__namespace.LinearFilter;
640
+ tex.magFilter = THREE5__namespace.LinearFilter;
641
+ tex.generateMipmaps = false;
642
+ tex.needsUpdate = true;
643
+ if (c.aspectRatio === void 0 && tex.image.width && tex.image.height) {
644
+ const natAspect = tex.image.width / tex.image.height;
645
+ material.uniforms.uImgAspect.value = natAspect;
646
+ }
647
+ },
648
+ void 0,
649
+ (err) => {
650
+ console.warn(`Failed to load constellation texture: ${texPath}`, err);
623
651
  }
624
- });
652
+ );
625
653
  if (c.zBias) {
626
654
  material.polygonOffset = true;
627
655
  material.polygonOffsetFactor = -c.zBias;
@@ -2515,9 +2543,19 @@ function createEngine({
2515
2543
  const t1 = touches[1];
2516
2544
  const newDistance = getTouchDistance(t0, t1);
2517
2545
  const scale = newDistance / state.pinchStartDistance;
2546
+ const prevFov = state.fov;
2518
2547
  state.fov = state.pinchStartFov / scale;
2519
2548
  state.fov = Math.max(ENGINE_CONFIG.minFov, Math.min(ENGINE_CONFIG.maxFov, state.fov));
2520
2549
  handlers.onFovChange?.(state.fov);
2550
+ if (state.fov > prevFov && state.fov > ENGINE_CONFIG.zenithStartFov) {
2551
+ const range = ENGINE_CONFIG.maxFov - ENGINE_CONFIG.zenithStartFov;
2552
+ let t = (state.fov - ENGINE_CONFIG.zenithStartFov) / range;
2553
+ t = Math.max(0, Math.min(1, t));
2554
+ const bias = ENGINE_CONFIG.zenithStrength * t;
2555
+ const zenithLat = Math.PI / 2 - 1e-3;
2556
+ state.lat = state.lat * (1 - bias) + zenithLat * bias;
2557
+ state.targetLat = state.lat;
2558
+ }
2521
2559
  const center = getTouchCenter(t0, t1);
2522
2560
  const deltaX = center.x - state.lastMouseX;
2523
2561
  const deltaY = center.y - state.lastMouseY;