1 import OpenSeadragon from 'openseadragon';
2 import React from 'react';
3 import { Button } from 'react-bootstrap';
4 import { useTranslation } from 'react-i18next';
7 const [viewer, setViewer] = React.useState(null);
9 const container = React.useRef();
10 const { t } = useTranslation();
12 React.useEffect(() => {
13 if (!container.current) return;
15 const v = OpenSeadragon({
16 element: container.current,
17 preserveViewport: true,
20 showNavigationControl: false,
21 showSequenceControl: false,
23 // new OpenSeadragon.DziTileSource({
30 // tilesUrl: '/media/alttp/map/lw_files/',
32 // }), new OpenSeadragon.DziTileSource({
39 // tilesUrl: '/media/alttp/map/dw_files/',
41 // }), new OpenSeadragon.DziTileSource({
48 // tilesUrl: '/media/alttp/map/sp_files/',
50 // }), new OpenSeadragon.DziTileSource({
57 // tilesUrl: '/media/alttp/map/uw_files/',
66 }, [container.current]);
68 const goToPage = React.useCallback((p) => {
69 if (viewer) viewer.goToPage(p);
73 <div className="d-flex align-items-center justify-content-between">
74 <div className="button-bar">
76 onClick={() => goToPage(0)}
77 title={t('map.lwLong')}
78 variant="outline-secondary"
83 onClick={() => goToPage(1)}
84 title={t('map.dwLong')}
85 variant="outline-secondary"
90 onClick={() => goToPage(2)}
91 title={t('map.spLong')}
92 variant="outline-secondary"
97 onClick={() => goToPage(3)}
98 title={t('map.uwLong')}
99 variant="outline-secondary"
105 <div ref={container} style={{ height: '80vh' }} />
109 export default Viewer;