mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Rollback basic.html and create coordinates.html.
Fix unit tests. Fix documentation.
This commit is contained in:
parent
791ecfae75
commit
3e5a9b52c9
@ -676,7 +676,7 @@ $.Viewport.prototype = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a delta (translation vector) from image pixels coordinates to viewport coordinates
|
* Convert a delta (translation vector) from pixels coordinates to viewport coordinates
|
||||||
* @function
|
* @function
|
||||||
* @param {Boolean} current - Pass true for the current location; defaults to false (target location).
|
* @param {Boolean} current - Pass true for the current location; defaults to false (target location).
|
||||||
*/
|
*/
|
||||||
@ -687,7 +687,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a delta (translation vector) from viewport coordinates to image pixels coordinates.
|
* Convert a delta (translation vector) from viewport coordinates to pixels coordinates.
|
||||||
* @function
|
* @function
|
||||||
* @param {Boolean} current - Pass true for the current location; defaults to false (target location).
|
* @param {Boolean} current - Pass true for the current location; defaults to false (target location).
|
||||||
*/
|
*/
|
||||||
@ -836,7 +836,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a pixel coordinates relative to the viewer element to image
|
* Convert pixel coordinates relative to the viewer element to image
|
||||||
* coordinates.
|
* coordinates.
|
||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
@ -847,7 +847,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a pixel coordinates relative to the image to
|
* Convert pixel coordinates relative to the image to
|
||||||
* viewer element coordinates.
|
* viewer element coordinates.
|
||||||
* @param {OpenSeadragon.Point} point
|
* @param {OpenSeadragon.Point} point
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
@ -858,7 +858,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a pixel coordinates relative to the window to image coordinates.
|
* Convert pixel coordinates relative to the window to image coordinates.
|
||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
@ -869,7 +869,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an image coordinates to pixel coordinates relative to the window.
|
* Convert image coordinates to pixel coordinates relative to the window.
|
||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
@ -880,7 +880,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a pixel coordinates relative to the viewer element to viewport
|
* Convert pixel coordinates relative to the viewer element to viewport
|
||||||
* coordinates.
|
* coordinates.
|
||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
@ -890,7 +890,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert viewport coordinates to a pixel coordinates relative to the
|
* Convert viewport coordinates to pixel coordinates relative to the
|
||||||
* viewer element.
|
* viewer element.
|
||||||
* @param {OpenSeadragon.Point} point
|
* @param {OpenSeadragon.Point} point
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
@ -900,7 +900,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a pixel coordinates relative to the window to viewport coordinates.
|
* Convert pixel coordinates relative to the window to viewport coordinates.
|
||||||
* @param {OpenSeadragon.Point} pixel
|
* @param {OpenSeadragon.Point} pixel
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
@ -911,7 +911,7 @@ $.Viewport.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert viewport coordinates to a pixel coordinates relative to the window.
|
* Convert viewport coordinates to pixel coordinates relative to the window.
|
||||||
* @param {OpenSeadragon.Point} point
|
* @param {OpenSeadragon.Point} point
|
||||||
* @returns {OpenSeadragon.Point}
|
* @returns {OpenSeadragon.Point}
|
||||||
*/
|
*/
|
||||||
|
@ -18,24 +18,6 @@
|
|||||||
Simple demo page to show a default OpenSeadragon viewer.
|
Simple demo page to show a default OpenSeadragon viewer.
|
||||||
</div>
|
</div>
|
||||||
<div id="contentDiv" class="openseadragon1"></div>
|
<div id="contentDiv" class="openseadragon1"></div>
|
||||||
<div>
|
|
||||||
<table border="1">
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Window (pixel)</th>
|
|
||||||
<th>Container (pixel)</th>
|
|
||||||
<th>Image (pixel)</th>
|
|
||||||
<th>Viewport (point)</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Cursor position</th>
|
|
||||||
<td id="windowPosition"></td>
|
|
||||||
<td id="containerPosition"></td>
|
|
||||||
<td id="imagePosition"></td>
|
|
||||||
<td id="viewportPosition"></td>
|
|
||||||
<tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var viewer = OpenSeadragon({
|
var viewer = OpenSeadragon({
|
||||||
@ -46,32 +28,6 @@
|
|||||||
showNavigator:true
|
showNavigator:true
|
||||||
});
|
});
|
||||||
|
|
||||||
function pointToString(point) {
|
|
||||||
return point.x.toPrecision(4) + "," + point.y.toPrecision(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
var onMouseTrackerMove = function(eventSender, eventData) {
|
|
||||||
var viewerX = eventData.position.x;
|
|
||||||
var viewerY = eventData.position.y;
|
|
||||||
var windowPoint = new OpenSeadragon.Point(viewerX, viewerY);
|
|
||||||
$("#windowPosition").text( pointToString(windowPoint));
|
|
||||||
|
|
||||||
var containerPoint = windowPoint.minus(
|
|
||||||
OpenSeadragon.getElementPosition(viewer.element));
|
|
||||||
$("#containerPosition").text( pointToString(containerPoint));
|
|
||||||
|
|
||||||
var imagePoint = viewer.viewport.windowToImageCoordinates(windowPoint);
|
|
||||||
$("#imagePosition").text( pointToString(imagePoint));
|
|
||||||
|
|
||||||
var viewportPoint = viewer.viewport.windowToViewportCoordinates(windowPoint);
|
|
||||||
$("#viewportPosition").text( pointToString(viewportPoint));
|
|
||||||
};
|
|
||||||
|
|
||||||
mouseTracker = new OpenSeadragon.MouseTracker({
|
|
||||||
element: document,
|
|
||||||
moveHandler: onMouseTrackerMove
|
|
||||||
}).setTracking(true);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
77
test/demo/coordinates.html
Normal file
77
test/demo/coordinates.html
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>OpenSeadragon Basic Demo</title>
|
||||||
|
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
|
||||||
|
<script type="text/javascript" src='../lib/jquery-1.9.1.min.js'></script>
|
||||||
|
<style type="text/css">
|
||||||
|
|
||||||
|
.openseadragon1 {
|
||||||
|
width: 800px;
|
||||||
|
height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
Simple demo page to show a default OpenSeadragon viewer.
|
||||||
|
</div>
|
||||||
|
<div id="contentDiv" class="openseadragon1"></div>
|
||||||
|
<div>
|
||||||
|
<table border="1">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Window (pixel)</th>
|
||||||
|
<th>Container (pixel)</th>
|
||||||
|
<th>Image (pixel)</th>
|
||||||
|
<th>Viewport (point)</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Cursor position</th>
|
||||||
|
<td id="windowPosition"></td>
|
||||||
|
<td id="containerPosition"></td>
|
||||||
|
<td id="imagePosition"></td>
|
||||||
|
<td id="viewportPosition"></td>
|
||||||
|
<tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var viewer = OpenSeadragon({
|
||||||
|
// debugMode: true,
|
||||||
|
id: "contentDiv",
|
||||||
|
prefixUrl: "../../build/openseadragon/images/",
|
||||||
|
tileSources: "../data/testpattern.dzi",
|
||||||
|
showNavigator:true
|
||||||
|
});
|
||||||
|
|
||||||
|
function pointToString(point) {
|
||||||
|
return point.x.toPrecision(4) + "," + point.y.toPrecision(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
var onMouseTrackerMove = function(eventSender, eventData) {
|
||||||
|
var viewerX = eventData.position.x;
|
||||||
|
var viewerY = eventData.position.y;
|
||||||
|
var windowPoint = new OpenSeadragon.Point(viewerX, viewerY);
|
||||||
|
$("#windowPosition").text( pointToString(windowPoint));
|
||||||
|
|
||||||
|
var containerPoint = windowPoint.minus(
|
||||||
|
OpenSeadragon.getElementPosition(viewer.element));
|
||||||
|
$("#containerPosition").text( pointToString(containerPoint));
|
||||||
|
|
||||||
|
var imagePoint = viewer.viewport.windowToImageCoordinates(windowPoint);
|
||||||
|
$("#imagePosition").text( pointToString(imagePoint));
|
||||||
|
|
||||||
|
var viewportPoint = viewer.viewport.windowToViewportCoordinates(windowPoint);
|
||||||
|
$("#viewportPosition").text( pointToString(viewportPoint));
|
||||||
|
};
|
||||||
|
|
||||||
|
mouseTracker = new OpenSeadragon.MouseTracker({
|
||||||
|
element: document,
|
||||||
|
moveHandler: onMouseTrackerMove
|
||||||
|
}).setTracking(true);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -16,4 +16,4 @@
|
|||||||
#unitsexample {
|
#unitsexample {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
width: 500px;
|
width: 500px;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@
|
|||||||
|
|
||||||
viewer.addHandler('animationfinish', zoomHandler);
|
viewer.addHandler('animationfinish', zoomHandler);
|
||||||
viewport.zoomTo(2);
|
viewport.zoomTo(2);
|
||||||
|
start();
|
||||||
});
|
});
|
||||||
|
|
||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
|
Loading…
Reference in New Issue
Block a user