@knaw-huc/osd-iiif-viewer 0.2.4 → 0.2.5

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.js CHANGED
@@ -1807,7 +1807,6 @@ const defaultManifest = {
1807
1807
  id: null,
1808
1808
  url: null,
1809
1809
  isLoading: !1,
1810
- isReady: !1,
1811
1810
  error: null
1812
1811
  }, createManifestSlice = (vault) => (set) => ({
1813
1812
  vault,
@@ -1837,11 +1836,14 @@ const defaultManifest = {
1837
1836
  }, createCanvasSlice = (set, get) => ({
1838
1837
  ...defaultCanvas,
1839
1838
  goToCanvas: (index) => {
1840
- const { vault, id: manifestId } = get();
1839
+ const { vault, id: manifestId, currentIndex } = get();
1841
1840
  if (!manifestId)
1842
1841
  return;
1843
- const manifest = vault.get({ id: manifestId, type: "Manifest" }), clamped = Math.max(0, Math.min(index, manifest.items.length - 1));
1844
- set({ currentIndex: clamped });
1842
+ const manifest = vault.get({ id: manifestId, type: "Manifest" }), newIndex = Math.max(0, Math.min(index, manifest.items.length - 1));
1843
+ newIndex !== currentIndex && set({
1844
+ currentIndex: newIndex,
1845
+ viewerReady: !1
1846
+ });
1845
1847
  },
1846
1848
  goToCanvasById: (id) => {
1847
1849
  const { vault, id: manifestId, goToCanvas } = get();
@@ -2032,8 +2034,8 @@ function Viewer(props) {
2032
2034
  }
2033
2035
  useEffect(openTileSource, [tileSource, store, isContainerReady]);
2034
2036
  function openTileSource() {
2035
- const state = store.getState(), viewer = state.viewer;
2036
- !viewer || !tileSource || (state.setViewerReady(!1), viewer.open(tileSource));
2037
+ const viewer = store.getState().viewer;
2038
+ !viewer || !tileSource || viewer.open(tileSource);
2037
2039
  }
2038
2040
  useEffect(resizeViewerOnContainerResize, [store]);
2039
2041
  function resizeViewerOnContainerResize() {
@@ -7,7 +7,6 @@ export type ManifestState = {
7
7
  url: string | null;
8
8
  isLoading: boolean;
9
9
  error: string | null;
10
- isReady: boolean;
11
10
  };
12
11
  export type ManifestSlice = Resettable & ManifestState & {
13
12
  vault: Vault;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knaw-huc/osd-iiif-viewer",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/knaw-huc/osd-iiif-viewer.git"