gralobe 1.0.66 → 1.0.68

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
@@ -174,6 +174,13 @@ export declare class GlobeViz implements GlobeVizAPI {
174
174
  private animationId;
175
175
  private isDestroyed;
176
176
  private urbanPoints;
177
+ private resizeObserver;
178
+ private lastContainerWidth;
179
+ private lastContainerHeight;
180
+ private hoverTooltip;
181
+ private currentHoveredFeature;
182
+ private lastHoverTime;
183
+ private readonly HOVER_THROTTLE_MS;
177
184
  /** Promise that resolves when fully initialized */
178
185
  ready: Promise<void>;
179
186
  private resolveReady;
@@ -196,9 +203,37 @@ export declare class GlobeViz implements GlobeVizAPI {
196
203
  toGlobe(): void;
197
204
  toFlat(): void;
198
205
  /**
199
- * Setup mouse interactions (Click to Zoom, etc.)
206
+ * Setup mouse interactions (Click to Zoom, Hover, etc.)
200
207
  */
201
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
+ * Find feature at given lat/lon using point-in-polygon test
219
+ */
220
+ private findFeatureAtLatLon;
221
+ /**
222
+ * Check if a point is inside a feature geometry
223
+ */
224
+ private isPointInFeature;
225
+ /**
226
+ * Ray casting algorithm for point-in-polygon test
227
+ */
228
+ private isPointInPolygon;
229
+ /**
230
+ * Show hover tooltip at mouse position
231
+ */
232
+ private showHoverTooltip;
233
+ /**
234
+ * Hide hover tooltip
235
+ */
236
+ private hideHoverTooltip;
202
237
  setMorph(value: number): void;
203
238
  getMorph(): number;
204
239
  setStatistic(idOrData: string | StatisticData): void;
@@ -226,6 +261,11 @@ export declare class GlobeViz implements GlobeVizAPI {
226
261
  recordGif(options?: ExportOptions): Promise<void>;
227
262
  recordVideo(options?: ExportOptions): Promise<void>;
228
263
  setEffects(effects: Partial<EffectsConfig>): void;
264
+ /**
265
+ * Update hover configuration
266
+ * @param hover - Partial hover configuration to merge
267
+ */
268
+ setHover(hover: Partial<HoverConfig>): void;
229
269
  setMarkers(data: MarkerData[], config?: MarkerConfig): void;
230
270
  setUrbanData(points: {
231
271
  lat: number;
@@ -278,6 +318,8 @@ export declare interface GlobeVizAPI {
278
318
  recordVideo(options?: ExportOptions): Promise<void>;
279
319
  /** Update effects configuration */
280
320
  setEffects(effects: Partial<EffectsConfig>): void;
321
+ /** Update hover configuration */
322
+ setHover(hover: Partial<HoverConfig>): void;
281
323
  /** Set marker data for city-level visualization */
282
324
  setMarkers(data: MarkerData[], config?: MarkerConfig): void;
283
325
  /** Set urban city data for visualization */
@@ -427,6 +469,48 @@ export declare interface GlobeVizConfig {
427
469
  * Callback for loading progress (0-1)
428
470
  */
429
471
  onLoadProgress?: (progress: number, status?: string) => void;
472
+ /**
473
+ * Callback when hovering over a feature
474
+ */
475
+ onHover?: (featureId: string | null, featureName: string | null, value?: number) => void;
476
+ /**
477
+ * Hover information configuration
478
+ */
479
+ hover?: HoverConfig;
480
+ }
481
+
482
+ /**
483
+ * Configuration for hover information display
484
+ */
485
+ export declare interface HoverConfig {
486
+ /**
487
+ * Enable hover information tooltip
488
+ * @default true
489
+ */
490
+ enabled?: boolean;
491
+ /**
492
+ * Minimum zoom level (camera distance) for hover to activate.
493
+ * Value between 0 and 1, where 0 means always show and 1 means only when very close.
494
+ * Maps to camera distance: 0 = 400 (far), 1 = 50 (close)
495
+ * @default 0 (always show)
496
+ */
497
+ minZoom?: number;
498
+ /**
499
+ * Show the feature value in the tooltip (if available)
500
+ * @default true
501
+ */
502
+ showValue?: boolean;
503
+ /**
504
+ * Custom tooltip style
505
+ */
506
+ style?: {
507
+ /** Background color */
508
+ background?: string;
509
+ /** Text color */
510
+ color?: string;
511
+ /** Border color */
512
+ borderColor?: string;
513
+ };
430
514
  }
431
515
 
432
516
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gralobe",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
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",
@@ -35,22 +35,9 @@
35
35
  "license": "MIT",
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "https://github.com/batikanor/gralobe"
38
+ "url": "git+https://github.com/batikanor/gralobe.git"
39
39
  },
40
40
  "homepage": "https://github.com/batikanor/gralobe#readme",
41
- "scripts": {
42
- "dev": "vite",
43
- "build": "tsc && vite build",
44
- "build:lib": "tsc && vite build --mode lib",
45
- "preview": "vite preview",
46
- "test": "vitest run",
47
- "test:watch": "vitest",
48
- "test:e2e": "playwright test",
49
- "test:ui": "playwright test --ui",
50
- "lint": "biome check .",
51
- "format": "biome check --write .",
52
- "prepublishOnly": "npm run build:lib"
53
- },
54
41
  "peerDependencies": {
55
42
  "three": ">=0.150.0"
56
43
  },
@@ -74,5 +61,17 @@
74
61
  "three": ">=0.150.0",
75
62
  "topojson-client": "^3.1.0",
76
63
  "world-atlas": "^2.0.2"
64
+ },
65
+ "scripts": {
66
+ "dev": "vite",
67
+ "build": "tsc && vite build",
68
+ "build:lib": "tsc && vite build --mode lib",
69
+ "preview": "vite preview",
70
+ "test": "vitest run",
71
+ "test:watch": "vitest",
72
+ "test:e2e": "playwright test",
73
+ "test:ui": "playwright test --ui",
74
+ "lint": "biome check .",
75
+ "format": "biome check --write ."
77
76
  }
78
- }
77
+ }