js-cloudimage-360-view 4.1.4 → 4.3.0

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
@@ -443,6 +443,7 @@ All options can be set via JavaScript config or HTML data attributes.
443
443
  | `lazyload` | `data-lazyload` | `true` | Enable lazy loading |
444
444
  | `hints` | `data-hints` | `true` | Show interaction hints on load |
445
445
  | `theme` | `data-theme` | `null` | Color theme: `'light'` or `'dark'` |
446
+ | `hotspotTrigger` | `data-hotspot-trigger` | `'hover'` | Hotspot trigger mode: `'hover'` or `'click'` |
446
447
  | `hotspotTimelineOnClick` | `data-hotspot-timeline-on-click` | `true` | Show hotspot popup when clicking timeline dot |
447
448
 
448
449
  ### Cloudimage CDN Options
@@ -842,14 +843,31 @@ viewer.updateView('my-viewer', { speed: 50, autoplay: true });
842
843
  ```javascript
843
844
  const view = viewer.getViewById('my-viewer');
844
845
 
845
- // Programmatically rotate the view
846
- view.onMoveHandler('right', 1, 0); // Move right by 1 frame
847
- view.onMoveHandler('left', 5, 0); // Move left by 5 frames
848
- view.onMoveHandler('up', 0, 1); // Move up by 1 frame (Y-axis)
849
- view.onMoveHandler('down', 0, 1); // Move down by 1 frame (Y-axis)
846
+ // Playback control
847
+ view.play(); // Start autoplay
848
+ view.stopAutoplay(); // Stop autoplay
850
849
 
851
- // Destroy the viewer
852
- view.destroy();
850
+ // Rotation (stopAtEdges: boolean, steps: number)
851
+ view.moveLeft(false, 5); // Rotate left by 5 frames
852
+ view.moveRight(false, 5); // Rotate right by 5 frames
853
+ view.moveTop(false, 1); // Rotate up by 1 frame (Y-axis)
854
+ view.moveBottom(false, 1); // Rotate down by 1 frame (Y-axis)
855
+
856
+ // Navigation
857
+ view.animateToFrame(36); // Animate to frame 36
858
+ view.animateToFrame(10, 'hotspot-1'); // Go to frame and show hotspot
859
+
860
+ // UI control
861
+ view.hideAllIcons(); // Hide all overlay icons
862
+
863
+ // State
864
+ view.activeImageX; // Current X-axis frame (0-indexed)
865
+ view.activeImageY; // Current Y-axis frame (0-indexed)
866
+ view.amountX; // Total X-axis frames
867
+ view.amountY; // Total Y-axis frames
868
+
869
+ // Cleanup
870
+ view.destroy(); // Destroy the viewer
853
871
  ```
854
872
 
855
873
  ---
@@ -897,6 +915,67 @@ const config = {
897
915
 
898
916
  ---
899
917
 
918
+ ## Mobile Considerations
919
+
920
+ ### Memory Limitations
921
+
922
+ Mobile browsers (especially Safari) have strict memory limits that can cause tab crashes when loading many high-resolution images. The library includes built-in optimizations for mobile that are **automatically enabled**:
923
+
924
+ - **Sequential image loading** (3 concurrent on mobile vs 6 on desktop)
925
+ - **Main-thread canvas rendering** (avoids OffscreenCanvas memory issues on Safari)
926
+ - **Reduced touch event rate** (30fps vs 100fps on desktop)
927
+ - **Capped device pixel ratio** (max 2x on mobile)
928
+ - **Automatic memory management** (releases off-screen viewers, frees memory when page backgrounded)
929
+
930
+ ### Recommended Settings for Mobile
931
+
932
+ | Setting | Desktop | Mobile | Notes |
933
+ |---------|---------|--------|-------|
934
+ | `amountX` | 60-100+ | 30-40 max | Each image uses ~4MB GPU memory |
935
+ | `pointerZoom` | ✅ | ❌ | Loads higher-res images |
936
+ | `magnifier` | ✅ | ❌ | Loads higher-res images |
937
+
938
+ ### Detecting Mobile Devices
939
+
940
+ The library automatically detects mobile devices, but you can also adjust your configuration:
941
+
942
+ ```javascript
943
+ const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
944
+ navigator.userAgent
945
+ );
946
+
947
+ const viewer = new CI360();
948
+ viewer.init(container, {
949
+ folder: 'https://example.com/images/',
950
+ filenameX: '{index}.jpg',
951
+ amountX: isMobile ? 36 : 72, // Fewer images on mobile
952
+ pointerZoom: isMobile ? false : 2, // Disable zoom on mobile
953
+ magnifier: isMobile ? false : 3, // Disable magnifier on mobile
954
+ });
955
+ ```
956
+
957
+ ### Memory Management API
958
+
959
+ Memory management is **automatically enabled on mobile**. For desktop or manual control:
960
+
961
+ ```javascript
962
+ const viewer = new CI360();
963
+ viewer.initAll();
964
+
965
+ // Manually enable (already auto-enabled on mobile)
966
+ viewer.enableMemoryManagement();
967
+
968
+ // Disable if needed
969
+ viewer.disableMemoryManagement();
970
+ ```
971
+
972
+ This uses IntersectionObserver to:
973
+ - Release memory when viewers scroll off-screen
974
+ - Reload images when viewers become visible again
975
+ - Release all viewer memory when the page is backgrounded
976
+
977
+ ---
978
+
900
979
  ## Migration Guide (v3 → v4)
901
980
 
902
981
  Version 4 introduces significant improvements in performance, customization, and developer experience. This guide helps you upgrade from v3.