mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
153 lines
5.0 KiB
HTML
153 lines
5.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>OSD-ThreeJS</title>
|
|
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
|
|
<script type="text/javascript" src='../lib/jquery-1.9.1.min.js'></script>
|
|
<script type="text/javascript" src='../lib/jquery-ui-1.10.2/js/jquery-ui-1.10.2.min.js'></script>
|
|
<link rel="stylesheet" href="../lib/jquery-ui-1.10.2/css/smoothness/jquery-ui-1.10.2.min.css">
|
|
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/17/Stats.js"></script> -->
|
|
<!-- <script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script> -->
|
|
<!-- <script type="importmap">
|
|
{
|
|
"imports": {
|
|
"three": "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.149.0/three.min.js"
|
|
}
|
|
} -->
|
|
</script>
|
|
<script type="module" src="./webgl.js"></script>
|
|
<style type="text/css">
|
|
.content{
|
|
max-width:960px;
|
|
margin: 0 auto;
|
|
}
|
|
.mirrored{
|
|
display:grid;
|
|
grid-template-columns:50% 50%;
|
|
gap: 2em;
|
|
}
|
|
.viewer-container {
|
|
/* width: 600px;
|
|
height: 400px; */
|
|
aspect-ratio: 4 / 3;
|
|
border: thin gray solid;
|
|
position:relative;
|
|
}
|
|
.example-code{
|
|
background-color:tan;
|
|
border: thin black solid;
|
|
padding:10px;
|
|
display:inline-block;
|
|
width:95%;
|
|
}
|
|
.description pre{
|
|
display:inline-block;
|
|
background-color:gainsboro;
|
|
padding:0;
|
|
margin:0;
|
|
}
|
|
|
|
.image-options{
|
|
display: grid;
|
|
grid-template-columns: 2em 9em 1fr;
|
|
padding:3px;
|
|
border: thin gray solid;
|
|
}
|
|
.option-grid{
|
|
display: grid;
|
|
grid-template-columns: 7em 7em 10em 10em 10em;
|
|
/* grid-template-columns: repeat(5, auto); */
|
|
}
|
|
.image-options input[type=number]{
|
|
width: 5em;
|
|
}
|
|
.image-options select{
|
|
width: 5em;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="content">
|
|
|
|
<h2>Compare behavior of <strong>Context2d</strong> and <strong>WebGL</strong> (via three.js) drawers</h2>
|
|
<div class="mirrored">
|
|
<div>
|
|
<h3>Context2d drawer (default in OSD <= 4.1.0)</h3>
|
|
<div id="context2d" class="viewer-container"></div>
|
|
</div>
|
|
|
|
<div>
|
|
<h3>New WebGL drawer</h3>
|
|
<div id="webgl" class="viewer-container"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="image-picker">
|
|
<h3>Image options (drag and drop to re-order images)</h3>
|
|
|
|
|
|
</div>
|
|
|
|
<h2>Use a custom plugin drawer - example using three.js</h2>
|
|
<div class="mirrored">
|
|
<div>
|
|
<div class="description">
|
|
The context2d drawing operations in core OpenSeadragon have been
|
|
consolidated from the <pre>TiledImage</pre> and <pre>Tile</pre> classes into the
|
|
<pre>Drawer</pre> class, which inherits from a new <pre>DrawerBase</pre> base class.
|
|
The <pre>TiledImage</pre> and <pre>Tile</pre> classes now handle the logic of managing
|
|
tile positioning and image data, with cleaner separation from details of the rendering
|
|
process. <pre>DrawerBase</pre> defines a public API that core OpenSeadragon code uses to
|
|
interact with the drawer implementation. To use a custom drawer/render, define
|
|
a new class that inherits from <pre>DrawerBase</pre> and implements the public API.
|
|
The constructor of this class can be passed in during construction of the viewer using the
|
|
new <pre>customDrawer</pre> option.
|
|
</div>
|
|
<pre class="example-code">
|
|
import { ThreeJSDrawer } from './threejsdrawer.js';
|
|
|
|
let viewer = OpenSeadragon({
|
|
...
|
|
drawer: ThreeJSDrawer,
|
|
...
|
|
});
|
|
</pre>
|
|
</div>
|
|
<div id="three-viewer" class="viewer-container"></div>
|
|
</div>
|
|
|
|
|
|
|
|
<h2>HTMLDrawer: legacy pre-HTML5 drawer that uses <img> elements for tiles</h2>
|
|
<div class="mirrored">
|
|
<div>
|
|
<div class="description">
|
|
HTML-based rendering can be selected in two different ways:
|
|
</div>
|
|
<pre class="example-code">
|
|
// via the 'html' drawer option:
|
|
let viewer = OpenSeadragon({
|
|
...
|
|
drawer: 'html',
|
|
...
|
|
});
|
|
|
|
// or by passing the HTMLDrawer constructor
|
|
let viewer = OpenSeadragon({
|
|
...
|
|
drawer:OpenSeadragon.HTMLDrawer,
|
|
...
|
|
});
|
|
</pre>
|
|
</div>
|
|
<div id="htmldrawer" class="viewer-container"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|