javascript - How to change first view position -
i use openseadragon 1.2.1.
i want show wide image(4096 x 2160), , change first view position.
x: 640px; y: 320px; width: 1024px; height:768px; crip(320px, 1664px, 1088px, 640px);
html code
<div id="mycanvas" style="width:1024px;height:768px;"></div> <script src="./openseadragon.min.js"></script> <script> var viewer = openseadragon( { id: "mycanvas", prefixurl: "./images/", tilesources: "./dzc_output_images/datas.xml" }); viewer.addhandler('open', function() { // want change first view position. // viewer.??? // viewer.viewport.applyconstraints(); } </script>
use "class:rect / class:displayrect" or other classes ?
https://openseadragon.github.io/docs/openseadragon.rect.html
https://openseadragon.github.io/docs/openseadragon.displayrect.html
how use these classes ?
your best bet figure out location want feature, rectangle in viewport coordinates (where 0 left side of image , 1 right side). instance (inside "open" handler you've written):
var box = new openseadragon.rect(0.25, 0.25, 0.5, 0.5); viewer.viewport.fitbounds(box, true);
Comments
Post a Comment