changeset 314:9dc7f1e8716d

reverse the order of the "sizes" field in the IIIF manifest
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Aug 2024 15:52:13 +0200
parents 584909ee8883
children 072968f00d26
files NEWS ViewerPlugin/IIIF.cpp
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Aug 14 15:43:28 2024 +0200
+++ b/NEWS	Wed Aug 14 15:52:13 2024 +0200
@@ -4,6 +4,8 @@
 * OrthancWSIDicomizer supports plain TIFF, besides hierarchical TIFF
 * New option: "tiff-alignment" to control deep zoom of plain TIFF over IIIF
 * Force version of Mirador to 3.3.0
+* In the IIIF manifest, reverse the order of the "sizes" field, which
+  seems to fix compatibility with Mirador v4.0.0-alpha
 
 
 Version 2.0 (2023-10-07)
--- a/ViewerPlugin/IIIF.cpp	Wed Aug 14 15:43:28 2024 +0200
+++ b/ViewerPlugin/IIIF.cpp	Wed Aug 14 15:52:13 2024 +0200
@@ -127,6 +127,18 @@
     }
   }
 
+  /**
+   * Reversing the order of the "sizes" field seems to be necessary
+   * for recent version of OpenSeadragon (>= 4.1.0) and Mirador (>=
+   * 4.0.0). This fix was included in release 2.1 of the WSI plugin.
+   * https://github.com/openseadragon/openseadragon/issues/2379
+   **/
+  Json::Value reversedSizes = Json::arrayValue;
+  for (Json::Value::ArrayIndex i = sizes.size(); i > 0; i--)
+  {
+    reversedSizes.append(sizes[i - 1]);
+  }
+
   Json::Value tiles;
   tiles["width"] = pyramid.GetTileWidth(0);
   tiles["height"] = pyramid.GetTileHeight(0);
@@ -141,7 +153,7 @@
   result["id"] = iiifPublicUrl_ + "tiles/" + seriesId;
   result["width"] = pyramid.GetLevelWidth(0);
   result["height"] = pyramid.GetLevelHeight(0);
-  result["sizes"] = sizes;
+  result["sizes"] = reversedSizes;
   result["tiles"].append(tiles);
 
   std::string s = result.toStyledString();