mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
demo update
This commit is contained in:
parent
66b4b29424
commit
524b42c778
@ -801,10 +801,10 @@ $.Viewport.prototype = {
|
||||
* Returns bounds taking constraints into account
|
||||
* Added to improve constrained panning
|
||||
* @param {Boolean} current - Pass true for the current location; defaults to false (target location).
|
||||
* @returns {OpenSeadragon.Rect} The bounds after applying constraints. The returned $.Rect contains additonal
|
||||
* properties constraintsApplied, xConstrained and yConstrained. These flags indicate
|
||||
* whether the viewport bounds were modified by the constraints of the viewer rectangle,
|
||||
* and in which dimension(s).
|
||||
* @returns {OpenSeadragon.Rect} The bounds in viewport coordinates after applying constraints. The returned $.Rect
|
||||
* contains additonal properties constraintsApplied, xConstrained and yConstrained.
|
||||
* These flags indicate whether the viewport bounds were modified by the constraints
|
||||
* of the viewer rectangle, and in which dimension(s).
|
||||
*/
|
||||
getConstrainedBounds: function(current) {
|
||||
var bounds,
|
||||
|
@ -12,9 +12,10 @@
|
||||
border:thin black solid;
|
||||
margin-right:20px;
|
||||
}
|
||||
|
||||
#controls li {
|
||||
cursor: pointer;
|
||||
#buttons button{
|
||||
width:10em;
|
||||
text-align:center;
|
||||
margin:5px;
|
||||
}
|
||||
.layout{
|
||||
display:grid;
|
||||
@ -63,7 +64,7 @@ setTimeout(() => viewport.applyConstraints(), 1000);</pre>
|
||||
</div>
|
||||
<button id="rotate">Rotate the viewer</button>
|
||||
<h3>Click to fit overlay bounds:</h3>
|
||||
<ul></ul>
|
||||
<div id="buttons"></div>
|
||||
<h4>overlay.getBounds(viewer.viewport):</h4>
|
||||
<pre class="bounds">Pick an overlay above to show the bounds</pre>
|
||||
</div>
|
||||
@ -122,7 +123,8 @@ setTimeout(() => viewport.applyConstraints(), 1000);</pre>
|
||||
|
||||
viewer.currentOverlays.forEach(overlay=>{
|
||||
var text = $(overlay.element).text();
|
||||
$('<li>').text(text).appendTo('#controls ul').on('click',()=>{
|
||||
var div=$('<div>').appendTo('#buttons');
|
||||
var buttons=$('<button>').text(text).appendTo(div).on('click',()=>{
|
||||
|
||||
var bounds = overlay.getBounds(viewer.viewport);
|
||||
$('.bounds').text(JSON.stringify(bounds,null,2));
|
||||
|
Loading…
Reference in New Issue
Block a user