@edgepdf/viewer-js 0.0.32 → 0.0.33

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/README.md CHANGED
@@ -8,18 +8,19 @@ Core JavaScript library for the EdgePDF viewer, providing Leaflet map integratio
8
8
  npm install @edgepdf/viewer-js
9
9
  # or
10
10
  pnpm add @edgepdf/viewer-js
11
+ # or
12
+ yarn add @edgepdf/viewer-js
11
13
  ```
12
14
 
13
15
  **Note:** Leaflet is bundled with this library, so you don't need to install it separately. **CSS styles are automatically injected** when you import the library - no manual CSS import needed!
14
16
 
15
- ## Usage
17
+ ## Quick Start
16
18
 
17
19
  ### Basic Example
18
20
 
19
21
  ```typescript
20
22
  import { EdgePdfViewer } from '@edgepdf/viewer-js';
21
23
  import type { ViewerConfig } from '@edgepdf/types';
22
- // CSS is automatically injected - no need to import styles manually!
23
24
 
24
25
  // Get container element
25
26
  const container = document.getElementById('map-container');
@@ -40,6 +41,16 @@ const config: ViewerConfig = {
40
41
  const viewer = new EdgePdfViewer({ container, config });
41
42
  viewer.initialize();
42
43
 
44
+ // Access marker manager
45
+ const markerManager = viewer.getMarkerManager();
46
+ if (markerManager) {
47
+ // Create a marker
48
+ const marker = markerManager.createMarker({
49
+ position: [1500, 1000], // [lat, lng] in Leaflet coordinates
50
+ label: 'My Marker',
51
+ });
52
+ }
53
+
43
54
  // Cleanup when done
44
55
  viewer.dispose();
45
56
  ```
@@ -49,7 +60,6 @@ viewer.dispose();
49
60
  ```typescript
50
61
  import { EdgePdfViewer } from '@edgepdf/viewer-js';
51
62
  import type { ViewerConfig, MapOptions } from '@edgepdf/types';
52
- // CSS is automatically injected - no need to import styles manually!
53
63
 
54
64
  const config: ViewerConfig = {
55
65
  tileUrl: 'https://example.com/tiles/{z}/{x}/{y}.png',
@@ -129,10 +139,428 @@ Checks if the map is initialized.
129
139
 
130
140
  **Returns:** `true` if map is initialized, `false` otherwise
131
141
 
142
+ ##### `getTileLayerManager(): TileLayerManager | null`
143
+
144
+ Gets the tile layer manager instance.
145
+
146
+ **Returns:** The tile layer manager, or `null` if not created
147
+
148
+ ##### `getCoordinateMapper(): CoordinateMapper | null`
149
+
150
+ Gets the coordinate mapper instance.
151
+
152
+ **Returns:** The coordinate mapper, or `null` if not created
153
+
154
+ ##### `getZoomController(): ZoomController | null`
155
+
156
+ Gets the zoom controller instance.
157
+
158
+ **Returns:** The zoom controller, or `null` if not created
159
+
160
+ ##### `getMarkerManager(): MarkerManager | null`
161
+
162
+ Gets the marker manager instance.
163
+
164
+ **Returns:** The marker manager, or `null` if not created
165
+
166
+ ##### `focusMarker(markerOrId: string | Marker, options?: FocusOptions): boolean`
167
+
168
+ Focuses on a marker by panning and zooming to its position.
169
+
170
+ **Parameters:**
171
+
172
+ - `markerOrId` - Marker ID string or Marker object
173
+ - `options` - Optional focus options
174
+ - `zoom?: number` - Target zoom level (uses marker's zoom or default if not provided)
175
+ - `animate?: boolean` - Whether to animate the transition (default: true)
176
+ - `duration?: number` - Animation duration in seconds (default: 0.5)
177
+
178
+ **Returns:** `true` if focus was successful, `false` if marker not found or viewer not initialized
179
+
132
180
  ##### `dispose(): void`
133
181
 
134
182
  Disposes of the map instance and cleans up resources. This should be called when the viewer is no longer needed to prevent memory leaks and event listener issues.
135
183
 
184
+ ---
185
+
186
+ ### MarkerManager
187
+
188
+ Manages markers on the Leaflet map. Access via `viewer.getMarkerManager()`.
189
+
190
+ #### Methods
191
+
192
+ ##### `createMarker(options: CreateMarkerOptions): Marker`
193
+
194
+ Creates a new marker from coordinates.
195
+
196
+ **Parameters:**
197
+
198
+ - `options.position?: LeafletCoords` - Leaflet coordinates [lat, lng]
199
+ - `options.imageCoords?: ImageCoords` - Image pixel coordinates {x, y}
200
+ - `options.label?: string` - Marker label/tooltip text
201
+ - `options.description?: string` - Marker description
202
+ - `options.href?: string` - Link URL (optional)
203
+ - `options.target?: string` - Link target (optional)
204
+ - `options.showLabel?: boolean` - Show label/tooltip
205
+ - `options.id?: string` - Custom marker ID (auto-generated if not provided)
206
+ - `options.iconType?: 'pin-gray' | 'pin-yellow'` - Icon type for the marker
207
+ - `options.referenceId?: string` - Reference ID for linking to external systems
208
+ - `options.draggable?: boolean` - Enable dragging for this specific marker
209
+ - `options.editable?: boolean` - Enable editing for this specific marker
210
+ - `options.deletable?: boolean` - Enable deleting for this specific marker
211
+
212
+ **Returns:** The created marker
213
+
214
+ **Throws:**
215
+
216
+ - `Error` if neither position nor imageCoords is provided
217
+ - `Error` if coordinates are invalid or out of bounds
218
+
219
+ ##### `getMarker(id: string): Marker | null`
220
+
221
+ Gets a marker by ID.
222
+
223
+ **Returns:** The marker, or `null` if not found
224
+
225
+ ##### `getAllMarkers(): Marker[]`
226
+
227
+ Gets all markers.
228
+
229
+ **Returns:** Array of all markers
230
+
231
+ ##### `getMarkerCount(): number`
232
+
233
+ Gets the total number of markers.
234
+
235
+ **Returns:** Number of markers
236
+
237
+ ##### `hasMarker(id: string): boolean`
238
+
239
+ Checks if a marker exists.
240
+
241
+ **Returns:** `true` if marker exists, `false` otherwise
242
+
243
+ ##### `updateMarker(id: string, updates: Partial<Marker>): boolean`
244
+
245
+ Updates a marker's properties.
246
+
247
+ **Parameters:**
248
+
249
+ - `id` - Marker ID
250
+ - `updates` - Partial marker object with properties to update
251
+
252
+ **Returns:** `true` if marker was updated, `false` if not found
253
+
254
+ ##### `updateMarkerPosition(id: string, position: LeafletCoords): boolean`
255
+
256
+ Updates a marker's position.
257
+
258
+ **Parameters:**
259
+
260
+ - `id` - Marker ID
261
+ - `position` - New Leaflet coordinates [lat, lng]
262
+
263
+ **Returns:** `true` if marker was updated, `false` if not found
264
+
265
+ ##### `updateMarkerIcon(id: string, iconType: 'pin-gray' | 'pin-yellow'): boolean`
266
+
267
+ Updates the icon type for a specific marker.
268
+
269
+ **Returns:** `true` if marker was updated, `false` if not found
270
+
271
+ ##### `updateAllMarkerIcons(iconType: 'pin-gray' | 'pin-yellow'): void`
272
+
273
+ Updates all markers to use a new icon type.
274
+
275
+ ##### `removeMarker(id: string): boolean`
276
+
277
+ Removes a marker by ID.
278
+
279
+ **Returns:** `true` if marker was removed, `false` if not found
280
+
281
+ ##### `removeAllMarkers(): void`
282
+
283
+ Removes all markers.
284
+
285
+ ##### `deleteMarker(id: string): boolean`
286
+
287
+ Deletes a marker by ID (triggers delete event).
288
+
289
+ **Returns:** `true` if marker was deleted, `false` if not found
290
+
291
+ ##### `exportMarkers(): MarkerData`
292
+
293
+ Exports all markers as JSON data.
294
+
295
+ **Returns:** MarkerData object containing all markers and metadata
296
+
297
+ ##### `importMarkers(data: MarkerData, options?: ImportOptions): ImportResult`
298
+
299
+ Imports markers from MarkerData.
300
+
301
+ **Parameters:**
302
+
303
+ - `data` - MarkerData object to import
304
+ - `options` - Import options
305
+ - `clearExisting?: boolean` - If true, removes all existing markers before import (default: false)
306
+ - `validateCoordinates?: boolean` - If true, validates coordinates are within bounds (default: true)
307
+
308
+ **Returns:** Import result with success status and details
309
+
310
+ ##### `setInteractionConfig(config: Partial<MarkerInteractionConfig>): void`
311
+
312
+ Sets marker interaction configuration.
313
+
314
+ **Parameters:**
315
+
316
+ - `config.draggable?: boolean` - Enable dragging markers
317
+ - `config.selectable?: boolean` - Enable selecting markers
318
+ - `config.showTooltips?: boolean` - Show tooltips on hover
319
+ - `config.showPopups?: boolean` - Show popups on click
320
+ - `config.multiSelect?: boolean` - Allow multiple marker selection
321
+ - `config.showEditButton?: boolean` - Show edit button in popups
322
+ - `config.showDeleteButton?: boolean` - Show delete button in popups
323
+ - `config.onEdit?: (marker: Marker) => Promise<Marker | null>` - Custom edit handler
324
+ - `config.onDelete?: (marker: Marker) => Promise<boolean>` - Custom delete handler
325
+ - `config.onActiveMarkerChange?: (marker: Marker | null) => void` - Active marker change callback
326
+
327
+ ##### `getInteractionConfig(): MarkerInteractionConfig`
328
+
329
+ Gets the current interaction configuration.
330
+
331
+ **Returns:** Current interaction configuration
332
+
333
+ ##### `selectMarker(id: string): boolean`
334
+
335
+ Selects a marker.
336
+
337
+ **Returns:** `true` if marker was selected, `false` if not found
338
+
339
+ ##### `deselectMarker(id: string): boolean`
340
+
341
+ Deselects a marker.
342
+
343
+ **Returns:** `true` if marker was deselected, `false` if not found
344
+
345
+ ##### `deselectAllMarkers(): void`
346
+
347
+ Deselects all markers.
348
+
349
+ ##### `getSelectionState(): MarkerSelectionState`
350
+
351
+ Gets the current selection state.
352
+
353
+ **Returns:** Selection state object with selected IDs and count
354
+
355
+ ##### `isMarkerSelected(id: string): boolean`
356
+
357
+ Checks if a marker is selected.
358
+
359
+ **Returns:** `true` if marker is selected, `false` otherwise
360
+
361
+ ##### `setActiveMarker(id: string | null): boolean`
362
+
363
+ Sets the active marker (for popup management).
364
+
365
+ **Returns:** `true` if active marker was set, `false` if marker not found
366
+
367
+ ##### `getActiveMarker(): Marker | null`
368
+
369
+ Gets the currently active marker.
370
+
371
+ **Returns:** The active marker, or `null` if no marker is active
372
+
373
+ ##### `focusMarker(markerOrId: string | Marker, options?: FocusOptions): boolean`
374
+
375
+ Focuses on a marker by panning and zooming to its position.
376
+
377
+ **Parameters:**
378
+
379
+ - `markerOrId` - Marker ID string or Marker object
380
+ - `options` - Optional focus options
381
+ - `zoom?: number` - Target zoom level
382
+ - `animate?: boolean` - Whether to animate (default: true)
383
+ - `duration?: number` - Animation duration in seconds (default: 0.5)
384
+
385
+ **Returns:** `true` if focus was successful, `false` if marker not found
386
+
387
+ ##### `setDefaultIconType(iconType: 'pin-gray' | 'pin-yellow'): void`
388
+
389
+ Sets the default icon type for new markers.
390
+
391
+ ##### `getDefaultIconType(): 'pin-gray' | 'pin-yellow'`
392
+
393
+ Gets the current default icon type.
394
+
395
+ **Returns:** Current default icon type
396
+
397
+ ##### `setIconBasePath(basePath: string): void`
398
+
399
+ Sets the base path for marker icons.
400
+
401
+ **Example:**
402
+
403
+ ```typescript
404
+ // Use library's built-in icons (default)
405
+ markerManager.setIconBasePath('./images/');
406
+
407
+ // Use custom icons from public folder
408
+ markerManager.setIconBasePath('/');
409
+
410
+ // Use icons from a CDN
411
+ markerManager.setIconBasePath('https://cdn.example.com/icons/');
412
+ ```
413
+
414
+ ##### `getIconBasePath(): string`
415
+
416
+ Gets the current base path for marker icons.
417
+
418
+ **Returns:** The current icon base path
419
+
420
+ ##### `on(eventType: MarkerEventType, callback: (event: MarkerEvent) => void): () => void`
421
+
422
+ Registers an event listener.
423
+
424
+ **Parameters:**
425
+
426
+ - `eventType` - Event type: 'click' | 'dragstart' | 'drag' | 'dragend' | 'edit' | 'delete'
427
+ - `callback` - Callback function
428
+
429
+ **Returns:** Unsubscribe function
430
+
431
+ **Example:**
432
+
433
+ ```typescript
434
+ const unsubscribe = markerManager.on('click', (event) => {
435
+ console.log('Marker clicked:', event.marker.id);
436
+ });
437
+
438
+ // Later, to unsubscribe:
439
+ unsubscribe();
440
+ ```
441
+
442
+ ##### `off(eventType: MarkerEventType, callback: (event: MarkerEvent) => void): void`
443
+
444
+ Unregisters an event listener.
445
+
446
+ ##### `removeAllListeners(eventType?: MarkerEventType): void`
447
+
448
+ Removes all event listeners for a specific event type, or all events if no type is provided.
449
+
450
+ ##### `dispose(): void`
451
+
452
+ Disposes of the marker manager and cleans up resources.
453
+
454
+ ---
455
+
456
+ ### ZoomController
457
+
458
+ Manages zoom state and operations. Access via `viewer.getZoomController()`.
459
+
460
+ #### Methods
461
+
462
+ ##### `zoomIn(options?: { animate?: boolean }): boolean`
463
+
464
+ Zooms in by one level.
465
+
466
+ **Parameters:**
467
+
468
+ - `options.animate?: boolean` - Whether to animate the zoom (default: true)
469
+
470
+ **Returns:** `true` if zoomed in, `false` if already at max zoom
471
+
472
+ ##### `zoomOut(options?: { animate?: boolean }): boolean`
473
+
474
+ Zooms out by one level.
475
+
476
+ **Parameters:**
477
+
478
+ - `options.animate?: boolean` - Whether to animate the zoom (default: true)
479
+
480
+ **Returns:** `true` if zoomed out, `false` if already at min zoom
481
+
482
+ ##### `setZoom(zoom: number, options?: { animate?: boolean }): void`
483
+
484
+ Sets a specific zoom level.
485
+
486
+ **Parameters:**
487
+
488
+ - `zoom` - Target zoom level
489
+ - `options.animate?: boolean` - Whether to animate the zoom (default: true)
490
+
491
+ **Throws:**
492
+
493
+ - `Error` if zoom is not a finite number
494
+
495
+ ##### `getZoom(): number`
496
+
497
+ Gets the current zoom level.
498
+
499
+ **Returns:** Current zoom level
500
+
501
+ ##### `getZoomState(): ZoomState`
502
+
503
+ Gets the current zoom state.
504
+
505
+ **Returns:** Zoom state object with currentZoom, minZoom, maxZoom
506
+
507
+ ##### `getMinZoom(): number`
508
+
509
+ Gets the minimum zoom level.
510
+
511
+ **Returns:** Minimum zoom level
512
+
513
+ ##### `getMaxZoom(): number`
514
+
515
+ Gets the maximum zoom level.
516
+
517
+ **Returns:** Maximum zoom level
518
+
519
+ ##### `canZoomIn(): boolean`
520
+
521
+ Checks if can zoom in.
522
+
523
+ **Returns:** `true` if can zoom in, `false` otherwise
524
+
525
+ ##### `canZoomOut(): boolean`
526
+
527
+ Checks if can zoom out.
528
+
529
+ **Returns:** `true` if can zoom out, `false` otherwise
530
+
531
+ ##### `onZoomChange(listener: (state: ZoomState) => void): () => void`
532
+
533
+ Registers a zoom change listener.
534
+
535
+ **Returns:** Unsubscribe function
536
+
537
+ ##### `removeAllListeners(): void`
538
+
539
+ Removes all zoom change listeners.
540
+
541
+ ##### `dispose(): void`
542
+
543
+ Disposes of the zoom controller and cleans up resources.
544
+
545
+ ---
546
+
547
+ ### Utility Functions
548
+
549
+ #### `createZoomControls(container: HTMLElement, zoomController: ZoomController, options?: ZoomControlsOptions): HTMLElement`
550
+
551
+ Creates zoom control buttons (zoom in/out) in the specified container.
552
+
553
+ **Parameters:**
554
+
555
+ - `container` - Container element
556
+ - `zoomController` - Zoom controller instance
557
+ - `options` - Optional configuration
558
+ - `position?: ZoomControlsPosition` - Position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' (default: 'top-right')
559
+
560
+ **Returns:** The created controls element
561
+
562
+ ---
563
+
136
564
  ## Configuration
137
565
 
138
566
  ### ViewerConfig
@@ -229,16 +657,77 @@ The viewer uses Leaflet's `CRS.Simple` coordinate system, which treats coordinat
229
657
  - Y-axis: vertical pixel position (0 to image height)
230
658
  - Origin: top-left corner (0, 0)
231
659
 
232
- ## Building
660
+ ## Examples
233
661
 
234
- Run `nx build viewer-js` to build the library.
662
+ ### Working with Markers
235
663
 
236
- ## Running Tests
664
+ ```typescript
665
+ const viewer = new EdgePdfViewer({ container, config });
666
+ viewer.initialize();
237
667
 
238
- Run `nx test viewer-js` to execute the unit tests via [Jest](https://jestjs.io).
668
+ const markerManager = viewer.getMarkerManager();
669
+ if (!markerManager) return;
670
+
671
+ // Create a marker
672
+ const marker = markerManager.createMarker({
673
+ position: [1500, 1000],
674
+ label: 'My Marker',
675
+ description: 'This is a marker description',
676
+ iconType: 'pin-yellow',
677
+ });
239
678
 
240
- Run `nx test viewer-js --coverage` to generate coverage reports.
679
+ // Update marker
680
+ markerManager.updateMarker(marker.id, {
681
+ label: 'Updated Label',
682
+ description: 'Updated description',
683
+ });
241
684
 
242
- ## License
685
+ // Listen to marker events
686
+ markerManager.on('click', (event) => {
687
+ console.log('Marker clicked:', event.marker);
688
+ });
243
689
 
244
- MIT
690
+ markerManager.on('dragend', (event) => {
691
+ console.log('Marker dragged to:', event.marker.position);
692
+ });
693
+
694
+ // Export markers
695
+ const markerData = markerManager.exportMarkers();
696
+ console.log(JSON.stringify(markerData, null, 2));
697
+
698
+ // Import markers
699
+ markerManager.importMarkers(markerData, {
700
+ clearExisting: true,
701
+ validateCoordinates: true,
702
+ });
703
+ ```
704
+
705
+ ### Working with Zoom
706
+
707
+ ```typescript
708
+ const viewer = new EdgePdfViewer({ container, config });
709
+ viewer.initialize();
710
+
711
+ const zoomController = viewer.getZoomController();
712
+ if (!zoomController) return;
713
+
714
+ // Zoom in
715
+ zoomController.zoomIn();
716
+
717
+ // Zoom out
718
+ zoomController.zoomOut();
719
+
720
+ // Set specific zoom level
721
+ zoomController.setZoom(3);
722
+
723
+ // Get zoom state
724
+ const zoomState = zoomController.getZoomState();
725
+ console.log('Current zoom:', zoomState.currentZoom);
726
+ console.log('Min zoom:', zoomState.minZoom);
727
+ console.log('Max zoom:', zoomState.maxZoom);
728
+
729
+ // Listen to zoom changes
730
+ zoomController.onZoomChange((state) => {
731
+ console.log('Zoom changed to:', state.currentZoom);
732
+ });
733
+ ```
package/dist/index.css CHANGED
@@ -1,3 +1,5 @@
1
+ @import "https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;600;700&display=swap";
2
+
1
3
  /* node_modules/.pnpm/leaflet@1.9.4/node_modules/leaflet/dist/leaflet.css */
2
4
  .leaflet-pane,
3
5
  .leaflet-tile,
@@ -673,6 +675,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
673
675
  display: flex;
674
676
  align-items: center;
675
677
  justify-content: center;
678
+ font-family: "Lato", sans-serif;
676
679
  }
677
680
  .edgepdf-marker-edit-popup-overlay {
678
681
  position: absolute;
@@ -680,14 +683,15 @@ svg.leaflet-image-layer.leaflet-interactive path {
680
683
  left: 0;
681
684
  right: 0;
682
685
  bottom: 0;
683
- background-color: rgba(0, 0, 0, 0.5);
686
+ background-color: rgba(0, 0, 0, 0.7);
684
687
  cursor: pointer;
685
688
  }
686
689
  .edgepdf-marker-edit-popup-content {
687
690
  position: relative;
688
- background-color: #fff;
691
+ background-color: #1a1a1a;
689
692
  border-radius: 8px;
690
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
693
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
694
+ border: 1px solid #333;
691
695
  width: 90%;
692
696
  max-width: 500px;
693
697
  max-height: 90vh;
@@ -699,20 +703,20 @@ svg.leaflet-image-layer.leaflet-interactive path {
699
703
  justify-content: space-between;
700
704
  align-items: center;
701
705
  padding: 16px 20px;
702
- border-bottom: 1px solid #e0e0e0;
706
+ border-bottom: 1px solid #333;
703
707
  }
704
708
  .edgepdf-marker-edit-popup-header h3 {
705
709
  margin: 0;
706
710
  font-size: 18px;
707
711
  font-weight: 600;
708
- color: #333;
712
+ color: #fff;
709
713
  }
710
714
  .edgepdf-marker-edit-popup-close {
711
715
  background: none;
712
716
  border: none;
713
717
  font-size: 24px;
714
718
  line-height: 1;
715
- color: #666;
719
+ color: #fff;
716
720
  cursor: pointer;
717
721
  padding: 0;
718
722
  width: 32px;
@@ -724,8 +728,8 @@ svg.leaflet-image-layer.leaflet-interactive path {
724
728
  transition: background-color 0.2s ease;
725
729
  }
726
730
  .edgepdf-marker-edit-popup-close:hover {
727
- background-color: #f0f0f0;
728
- color: #333;
731
+ background-color: #333;
732
+ color: #ffa500;
729
733
  }
730
734
  .edgepdf-marker-edit-popup-body {
731
735
  padding: 20px;
@@ -741,52 +745,57 @@ svg.leaflet-image-layer.leaflet-interactive path {
741
745
  margin-bottom: 8px;
742
746
  font-size: 14px;
743
747
  font-weight: 500;
744
- color: #333;
748
+ color: #fff;
745
749
  }
746
750
  .edgepdf-marker-edit-input {
747
751
  width: 100%;
748
752
  padding: 10px 12px;
749
- border: 1px solid #ccc;
753
+ border: 1px solid #444;
750
754
  border-radius: 4px;
751
755
  font-size: 14px;
756
+ background-color: #2a2a2a;
757
+ color: #fff;
752
758
  box-sizing: border-box;
753
759
  transition: border-color 0.2s ease;
754
760
  }
755
761
  .edgepdf-marker-edit-input:focus {
756
762
  outline: none;
757
- border-color: #1976d2;
758
- box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
763
+ border-color: #ffa500;
764
+ box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.2);
765
+ }
766
+ .edgepdf-marker-edit-input::placeholder {
767
+ color: #888;
759
768
  }
760
769
  .edgepdf-marker-edit-popup-footer {
761
770
  display: flex;
762
771
  justify-content: flex-end;
763
772
  gap: 12px;
764
773
  padding: 16px 20px;
765
- border-top: 1px solid #e0e0e0;
774
+ border-top: 1px solid #333;
766
775
  }
767
776
  .edgepdf-marker-edit-button {
768
777
  padding: 10px 20px;
769
- border: 1px solid #ccc;
778
+ border: 1px solid #444;
770
779
  border-radius: 4px;
771
- background-color: #fff;
772
- color: #333;
780
+ background-color: #2a2a2a;
781
+ color: #fff;
773
782
  cursor: pointer;
774
783
  font-size: 14px;
775
784
  font-weight: 500;
776
785
  transition: all 0.2s ease;
777
786
  }
778
787
  .edgepdf-marker-edit-button-cancel:hover {
779
- background-color: #f0f0f0;
780
- border-color: #999;
788
+ background-color: #333;
789
+ border-color: #555;
781
790
  }
782
791
  .edgepdf-marker-edit-button-save {
783
- background-color: #1976d2;
784
- color: #fff;
785
- border-color: #1976d2;
792
+ background-color: #ffa500;
793
+ color: #000;
794
+ border-color: #ffa500;
786
795
  }
787
796
  .edgepdf-marker-edit-button-save:hover {
788
- background-color: #1565c0;
789
- border-color: #1565c0;
797
+ background-color: #ffd700;
798
+ border-color: #ffd700;
790
799
  }
791
800
  .edgepdf-marker-delete-popup {
792
801
  position: fixed;
@@ -798,6 +807,7 @@ svg.leaflet-image-layer.leaflet-interactive path {
798
807
  display: flex;
799
808
  align-items: center;
800
809
  justify-content: center;
810
+ font-family: "Lato", sans-serif;
801
811
  }
802
812
  .edgepdf-marker-delete-popup-overlay {
803
813
  position: absolute;
@@ -805,14 +815,15 @@ svg.leaflet-image-layer.leaflet-interactive path {
805
815
  left: 0;
806
816
  right: 0;
807
817
  bottom: 0;
808
- background-color: rgba(0, 0, 0, 0.5);
818
+ background-color: rgba(0, 0, 0, 0.7);
809
819
  cursor: pointer;
810
820
  }
811
821
  .edgepdf-marker-delete-popup-content {
812
822
  position: relative;
813
- background-color: #fff;
823
+ background-color: #1a1a1a;
814
824
  border-radius: 8px;
815
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
825
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
826
+ border: 1px solid #333;
816
827
  width: 90%;
817
828
  max-width: 500px;
818
829
  max-height: 90vh;
@@ -824,20 +835,20 @@ svg.leaflet-image-layer.leaflet-interactive path {
824
835
  justify-content: space-between;
825
836
  align-items: center;
826
837
  padding: 16px 20px;
827
- border-bottom: 1px solid #e0e0e0;
838
+ border-bottom: 1px solid #333;
828
839
  }
829
840
  .edgepdf-marker-delete-popup-header h3 {
830
841
  margin: 0;
831
842
  font-size: 18px;
832
843
  font-weight: 600;
833
- color: #333;
844
+ color: #fff;
834
845
  }
835
846
  .edgepdf-marker-delete-popup-close {
836
847
  background: none;
837
848
  border: none;
838
849
  font-size: 24px;
839
850
  line-height: 1;
840
- color: #666;
851
+ color: #fff;
841
852
  cursor: pointer;
842
853
  padding: 0;
843
854
  width: 32px;
@@ -849,8 +860,8 @@ svg.leaflet-image-layer.leaflet-interactive path {
849
860
  transition: background-color 0.2s ease;
850
861
  }
851
862
  .edgepdf-marker-delete-popup-close:hover {
852
- background-color: #f0f0f0;
853
- color: #333;
863
+ background-color: #333;
864
+ color: #ffa500;
854
865
  }
855
866
  .edgepdf-marker-delete-popup-body {
856
867
  padding: 20px;
@@ -858,43 +869,43 @@ svg.leaflet-image-layer.leaflet-interactive path {
858
869
  .edgepdf-marker-delete-popup-body p {
859
870
  margin: 0;
860
871
  font-size: 14px;
861
- color: #333;
872
+ color: #fff;
862
873
  line-height: 1.5;
863
874
  }
864
875
  .edgepdf-marker-delete-popup-body strong {
865
876
  font-weight: 600;
866
- color: #d32f2f;
877
+ color: #ffa500;
867
878
  }
868
879
  .edgepdf-marker-delete-popup-footer {
869
880
  display: flex;
870
881
  justify-content: flex-end;
871
882
  gap: 12px;
872
883
  padding: 16px 20px;
873
- border-top: 1px solid #e0e0e0;
884
+ border-top: 1px solid #333;
874
885
  }
875
886
  .edgepdf-marker-delete-button {
876
887
  padding: 10px 20px;
877
- border: 1px solid #ccc;
888
+ border: 1px solid #444;
878
889
  border-radius: 4px;
879
- background-color: #fff;
880
- color: #333;
890
+ background-color: #2a2a2a;
891
+ color: #fff;
881
892
  cursor: pointer;
882
893
  font-size: 14px;
883
894
  font-weight: 500;
884
895
  transition: all 0.2s ease;
885
896
  }
886
897
  .edgepdf-marker-delete-button-cancel:hover {
887
- background-color: #f0f0f0;
888
- border-color: #999;
898
+ background-color: #333;
899
+ border-color: #555;
889
900
  }
890
901
  .edgepdf-marker-delete-button-confirm {
891
- background-color: #d32f2f;
892
- color: #fff;
893
- border-color: #d32f2f;
902
+ background-color: #ffa500;
903
+ color: #000;
904
+ border-color: #ffa500;
894
905
  }
895
906
  .edgepdf-marker-delete-button-confirm:hover {
896
- background-color: #b71c1c;
897
- border-color: #b71c1c;
907
+ background-color: #ffd700;
908
+ border-color: #ffd700;
898
909
  }
899
910
  .edgepdf-marker-icon-overlay-container {
900
911
  background: transparent !important;
package/dist/index.js CHANGED
@@ -9589,6 +9589,12 @@ var S3_PREFIX = {
9589
9589
  PROCESSED: "processed"
9590
9590
  };
9591
9591
  var MAX_ZOOM_LEVEL = 4;
9592
+ var MARKER_SPEC = {
9593
+ WIDTH: 30,
9594
+ HEIGHT: 40,
9595
+ ANCHOR_X: 16,
9596
+ ANCHOR_Y: 36
9597
+ };
9592
9598
  function calculateTileCount(imageSize, tileSize, zoom) {
9593
9599
  if (imageSize <= 0 || tileSize <= 0 || zoom < 0) {
9594
9600
  return 0;
@@ -11290,6 +11296,65 @@ var MarkerManager = class {
11290
11296
  this.updateMarkerIcon(id, iconType);
11291
11297
  });
11292
11298
  }
11299
+ /**
11300
+ * Focuses on a marker by panning and zooming to its position
11301
+ *
11302
+ * This method smoothly animates the map view to center on the specified marker
11303
+ * and optionally sets a specific zoom level. If no zoom level is provided,
11304
+ * it uses the marker's saved zoom level or a reasonable default.
11305
+ *
11306
+ * @param markerOrId - Marker ID string or Marker object
11307
+ * @param options - Optional focus options
11308
+ * @param options.zoom - Target zoom level (uses marker's zoom or default if not provided)
11309
+ * @param options.animate - Whether to animate the transition (default: true)
11310
+ * @param options.duration - Animation duration in seconds (default: 0.5)
11311
+ * @returns True if focus was successful, false if marker not found
11312
+ *
11313
+ * @example
11314
+ * ```typescript
11315
+ * // Focus on marker by ID
11316
+ * markerManager.focusMarker('marker-123');
11317
+ *
11318
+ * // Focus with specific zoom level
11319
+ * markerManager.focusMarker('marker-123', { zoom: 3 });
11320
+ *
11321
+ * // Focus without animation
11322
+ * markerManager.focusMarker('marker-123', { animate: false });
11323
+ *
11324
+ * // Focus with custom duration
11325
+ * markerManager.focusMarker('marker-123', { zoom: 2, duration: 1.0 });
11326
+ * ```
11327
+ */
11328
+ focusMarker(markerOrId, options) {
11329
+ let marker = null;
11330
+ if (typeof markerOrId === "string") {
11331
+ marker = this.getMarker(markerOrId);
11332
+ } else {
11333
+ marker = markerOrId;
11334
+ }
11335
+ if (!marker) {
11336
+ console.warn(`Marker not found: ${markerOrId}`);
11337
+ return false;
11338
+ }
11339
+ const targetZoom = options?.zoom ?? marker.zoom ?? 2;
11340
+ const minZoom = this.imageInfo.minZoom ?? 0;
11341
+ const maxZoom = this.imageInfo.maxZoom ?? 5;
11342
+ const constrainedZoom = Math.max(minZoom, Math.min(maxZoom, targetZoom));
11343
+ const position = [
11344
+ marker.position[0],
11345
+ marker.position[1]
11346
+ ];
11347
+ const animate = options?.animate !== false;
11348
+ const duration = options?.duration ?? 0.5;
11349
+ if (animate) {
11350
+ this.map.flyTo(position, constrainedZoom, {
11351
+ duration
11352
+ });
11353
+ } else {
11354
+ this.map.setView(position, constrainedZoom);
11355
+ }
11356
+ return true;
11357
+ }
11293
11358
  /**
11294
11359
  * Disposes of the marker manager and cleans up resources
11295
11360
  *
@@ -11312,10 +11377,9 @@ var MarkerManager = class {
11312
11377
  const iconUrl = `${this.iconBasePath}${iconType}.png`;
11313
11378
  return import_leaflet3.default.icon({
11314
11379
  iconUrl,
11315
- iconSize: [30, 40],
11316
- // Default marker size
11317
- iconAnchor: [16, 36],
11318
- // Point of the icon which will correspond to marker's location
11380
+ iconSize: [MARKER_SPEC.WIDTH, MARKER_SPEC.HEIGHT],
11381
+ iconAnchor: [MARKER_SPEC.ANCHOR_X, MARKER_SPEC.ANCHOR_Y],
11382
+ // Anchor point aligns with marker location
11319
11383
  popupAnchor: [0, 0],
11320
11384
  // Point from which the popup should open relative to the iconAnchor
11321
11385
  shadowUrl: void 0,
@@ -11445,8 +11509,8 @@ var MarkerManager = class {
11445
11509
  }
11446
11510
  const overlaySize = 40;
11447
11511
  const borderWidth = 1;
11448
- const overlayAnchorX = 20;
11449
- const overlayAnchorY = 35;
11512
+ const overlayAnchorX = overlaySize / 2 + (MARKER_SPEC.WIDTH / 2 - MARKER_SPEC.ANCHOR_X);
11513
+ const overlayAnchorY = overlaySize / 2 + (MARKER_SPEC.HEIGHT / 2 - MARKER_SPEC.ANCHOR_Y);
11450
11514
  const overlayHTML = `
11451
11515
  <div style="
11452
11516
  width: ${overlaySize}px;
@@ -12407,6 +12471,34 @@ var EdgePdfViewer = class {
12407
12471
  getMarkerManager() {
12408
12472
  return this.markerManager;
12409
12473
  }
12474
+ /**
12475
+ * Focuses on a marker by panning and zooming to its position
12476
+ *
12477
+ * This is a convenience method that delegates to the marker manager's focusMarker method.
12478
+ *
12479
+ * @param markerOrId - Marker ID string or Marker object
12480
+ * @param options - Optional focus options
12481
+ * @param options.zoom - Target zoom level (uses marker's zoom or default if not provided)
12482
+ * @param options.animate - Whether to animate the transition (default: true)
12483
+ * @param options.duration - Animation duration in seconds (default: 0.5)
12484
+ * @returns True if focus was successful, false if marker not found or viewer not initialized
12485
+ *
12486
+ * @example
12487
+ * ```typescript
12488
+ * // Focus on marker by ID
12489
+ * viewer.focusMarker('marker-123');
12490
+ *
12491
+ * // Focus with specific zoom level
12492
+ * viewer.focusMarker('marker-123', { zoom: 3 });
12493
+ * ```
12494
+ */
12495
+ focusMarker(markerOrId, options) {
12496
+ if (!this.markerManager) {
12497
+ console.warn("Marker manager not available");
12498
+ return false;
12499
+ }
12500
+ return this.markerManager.focusMarker(markerOrId, options);
12501
+ }
12410
12502
  /**
12411
12503
  * Disposes of the map instance and cleans up resources
12412
12504
  *
@@ -373,6 +373,40 @@ export declare class MarkerManager {
373
373
  * @param iconType - Icon type to apply to all markers
374
374
  */
375
375
  updateAllMarkerIcons(iconType: 'pin-gray' | 'pin-yellow'): void;
376
+ /**
377
+ * Focuses on a marker by panning and zooming to its position
378
+ *
379
+ * This method smoothly animates the map view to center on the specified marker
380
+ * and optionally sets a specific zoom level. If no zoom level is provided,
381
+ * it uses the marker's saved zoom level or a reasonable default.
382
+ *
383
+ * @param markerOrId - Marker ID string or Marker object
384
+ * @param options - Optional focus options
385
+ * @param options.zoom - Target zoom level (uses marker's zoom or default if not provided)
386
+ * @param options.animate - Whether to animate the transition (default: true)
387
+ * @param options.duration - Animation duration in seconds (default: 0.5)
388
+ * @returns True if focus was successful, false if marker not found
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * // Focus on marker by ID
393
+ * markerManager.focusMarker('marker-123');
394
+ *
395
+ * // Focus with specific zoom level
396
+ * markerManager.focusMarker('marker-123', { zoom: 3 });
397
+ *
398
+ * // Focus without animation
399
+ * markerManager.focusMarker('marker-123', { animate: false });
400
+ *
401
+ * // Focus with custom duration
402
+ * markerManager.focusMarker('marker-123', { zoom: 2, duration: 1.0 });
403
+ * ```
404
+ */
405
+ focusMarker(markerOrId: string | Marker, options?: {
406
+ zoom?: number;
407
+ animate?: boolean;
408
+ duration?: number;
409
+ }): boolean;
376
410
  /**
377
411
  * Disposes of the marker manager and cleans up resources
378
412
  *
@@ -1 +1 @@
1
- {"version":3,"file":"marker-manager.d.ts","sourceRoot":"","sources":["../../src/lib/marker-manager.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AACxB,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC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 export declare class EdgePdfViewer {
124
124
  * @returns The marker manager, or null if not created
125
125
  */
126
126
  getMarkerManager(): MarkerManager | null;
127
+ /**
128
+ * Focuses on a marker by panning and zooming to its position
129
+ *
130
+ * This is a convenience method that delegates to the marker manager's focusMarker method.
131
+ *
132
+ * @param markerOrId - Marker ID string or Marker object
133
+ * @param options - Optional focus options
134
+ * @param options.zoom - Target zoom level (uses marker's zoom or default if not provided)
135
+ * @param options.animate - Whether to animate the transition (default: true)
136
+ * @param options.duration - Animation duration in seconds (default: 0.5)
137
+ * @returns True if focus was successful, false if marker not found or viewer not initialized
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * // Focus on marker by ID
142
+ * viewer.focusMarker('marker-123');
143
+ *
144
+ * // Focus with specific zoom level
145
+ * viewer.focusMarker('marker-123', { zoom: 3 });
146
+ * ```
147
+ */
148
+ focusMarker(markerOrId: string | import('@edgepdf/types').Marker, options?: {
149
+ zoom?: number;
150
+ animate?: boolean;
151
+ duration?: number;
152
+ }): boolean;
127
153
  /**
128
154
  * Disposes of the map instance and cleans up resources
129
155
  *
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../src/lib/viewer.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAe;I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ACA,OAAO;IASV;;;;;OAKG;IACH,OAAO,IAAI,IAAI;CA0BhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgepdf/viewer-js",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "EdgePDF Viewer - JavaScript library for viewing PDF documents with interactive markers and zoom controls",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",