-import OpenSeadragon from 'openseadragon';
import PropTypes from 'prop-types';
import React from 'react';
+import { useSearchParams } from 'react-router-dom';
import Overlay from './Overlay';
import { useOpenSeadragon } from './OpenSeadragon';
};
const UWSuperTiles = ({ show }) => {
- const { viewer } = useOpenSeadragon();
+ const { storePosition, viewer } = useOpenSeadragon();
+ const [, setSearchParams] = useSearchParams();
const onClick = React.useCallback(e => {
if (e.originalTarget.tagName !== 'A') return;
const x = (parseInt(key[1], 16) + 0.5) / 16;
const y = (parseInt(key[0], 16) + 0.5) / 16;
if (viewer && viewer.viewport) {
- viewer.viewport.panTo(new OpenSeadragon.Point(x, y));
- viewer.viewport.zoomTo(4);
+ storePosition();
+ setSearchParams({ x, y, z: 4 });
viewer.element.scrollIntoView();
}
- }, [viewer]);
+ }, [storePosition, viewer]);
return <Overlay onClick={onClick} page={3} x={0} y={0} width={1} height={1}>
<div className={`uw-super-tiles ${show ? '' : 'd-none'}`}>