gralobe 1.0.67 → 1.0.69

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.d.ts CHANGED
@@ -177,6 +177,10 @@ export declare class GlobeViz implements GlobeVizAPI {
177
177
  private resizeObserver;
178
178
  private lastContainerWidth;
179
179
  private lastContainerHeight;
180
+ private hoverTooltip;
181
+ private currentHoveredFeature;
182
+ private lastHoverTime;
183
+ private readonly HOVER_THROTTLE_MS;
180
184
  /** Promise that resolves when fully initialized */
181
185
  ready: Promise<void>;
182
186
  private resolveReady;
@@ -199,9 +203,52 @@ export declare class GlobeViz implements GlobeVizAPI {
199
203
  toGlobe(): void;
200
204
  toFlat(): void;
201
205
  /**
202
- * Setup mouse interactions (Click to Zoom, etc.)
206
+ * Setup mouse interactions (Click to Zoom, Hover, etc.)
203
207
  */
204
208
  private setupInteraction;
209
+ /**
210
+ * Create the hover tooltip element
211
+ */
212
+ private createHoverTooltip;
213
+ /**
214
+ * Handle hover interactions with throttling for performance
215
+ */
216
+ private handleHover;
217
+ /**
218
+ * Mathematical ray-sphere intersection
219
+ * Returns the closest intersection point on the front face of the sphere,
220
+ * or null if the ray doesn't hit the sphere.
221
+ *
222
+ * This is necessary because the globe mesh is a PlaneGeometry that's morphed
223
+ * to a sphere via GPU shaders - raycasting against the mesh would hit the
224
+ * original plane geometry, not the visual sphere.
225
+ *
226
+ * @param rayOrigin - Ray origin point
227
+ * @param rayDirection - Normalized ray direction vector
228
+ * @param radius - Sphere radius (centered at origin)
229
+ * @returns Intersection point or null
230
+ */
231
+ private raySphereIntersection;
232
+ /**
233
+ * Find feature at given lat/lon using point-in-polygon test
234
+ */
235
+ private findFeatureAtLatLon;
236
+ /**
237
+ * Check if a point is inside a feature geometry
238
+ */
239
+ private isPointInFeature;
240
+ /**
241
+ * Ray casting algorithm for point-in-polygon test
242
+ */
243
+ private isPointInPolygon;
244
+ /**
245
+ * Show hover tooltip at mouse position
246
+ */
247
+ private showHoverTooltip;
248
+ /**
249
+ * Hide hover tooltip
250
+ */
251
+ private hideHoverTooltip;
205
252
  setMorph(value: number): void;
206
253
  getMorph(): number;
207
254
  setStatistic(idOrData: string | StatisticData): void;
@@ -229,6 +276,11 @@ export declare class GlobeViz implements GlobeVizAPI {
229
276
  recordGif(options?: ExportOptions): Promise<void>;
230
277
  recordVideo(options?: ExportOptions): Promise<void>;
231
278
  setEffects(effects: Partial<EffectsConfig>): void;
279
+ /**
280
+ * Update hover configuration
281
+ * @param hover - Partial hover configuration to merge
282
+ */
283
+ setHover(hover: Partial<HoverConfig>): void;
232
284
  setMarkers(data: MarkerData[], config?: MarkerConfig): void;
233
285
  setUrbanData(points: {
234
286
  lat: number;
@@ -281,6 +333,8 @@ export declare interface GlobeVizAPI {
281
333
  recordVideo(options?: ExportOptions): Promise<void>;
282
334
  /** Update effects configuration */
283
335
  setEffects(effects: Partial<EffectsConfig>): void;
336
+ /** Update hover configuration */
337
+ setHover(hover: Partial<HoverConfig>): void;
284
338
  /** Set marker data for city-level visualization */
285
339
  setMarkers(data: MarkerData[], config?: MarkerConfig): void;
286
340
  /** Set urban city data for visualization */
@@ -430,6 +484,48 @@ export declare interface GlobeVizConfig {
430
484
  * Callback for loading progress (0-1)
431
485
  */
432
486
  onLoadProgress?: (progress: number, status?: string) => void;
487
+ /**
488
+ * Callback when hovering over a feature
489
+ */
490
+ onHover?: (featureId: string | null, featureName: string | null, value?: number) => void;
491
+ /**
492
+ * Hover information configuration
493
+ */
494
+ hover?: HoverConfig;
495
+ }
496
+
497
+ /**
498
+ * Configuration for hover information display
499
+ */
500
+ export declare interface HoverConfig {
501
+ /**
502
+ * Enable hover information tooltip
503
+ * @default true
504
+ */
505
+ enabled?: boolean;
506
+ /**
507
+ * Minimum zoom level (camera distance) for hover to activate.
508
+ * Value between 0 and 1, where 0 means always show and 1 means only when very close.
509
+ * Maps to camera distance: 0 = 400 (far), 1 = 50 (close)
510
+ * @default 0 (always show)
511
+ */
512
+ minZoom?: number;
513
+ /**
514
+ * Show the feature value in the tooltip (if available)
515
+ * @default true
516
+ */
517
+ showValue?: boolean;
518
+ /**
519
+ * Custom tooltip style
520
+ */
521
+ style?: {
522
+ /** Background color */
523
+ background?: string;
524
+ /** Text color */
525
+ color?: string;
526
+ /** Border color */
527
+ borderColor?: string;
528
+ };
433
529
  }
434
530
 
435
531
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gralobe",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "description": "Interactive 3D globe visualization with statistics, smooth flat map ↔ globe transitions, and country labels",
5
5
  "type": "module",
6
6
  "main": "./dist/gralobe.umd.cjs",