1540 Address reviewer comment to better document viewportCoordToDrawerCoord function

This commit is contained in:
Yansong Hong 2020-02-07 13:15:03 -08:00
parent 94183f7f18
commit dadef91ce0

View File

@ -167,14 +167,17 @@ $.Drawer.prototype = {
}, },
/** /**
* This function gets the top left point from the viewport using the pixel point * This function converts the given point from to the drawer coordinate by
* @param {OpenSeadragon.Point} point - the pixel points to convert * multiplying it with the pixel density.
* This function does not take rotation into account, thus assuming provided
* point is at 0 degree.
* @param {OpenSeadragon.Point} point - the pixel point to convert
*/ */
viewportCoordToDrawerCoord: function(point) { viewportCoordToDrawerCoord: function(point) {
var topLeft = this.viewport.pixelFromPointNoRotate(point, true); var vpPoint = this.viewport.pixelFromPointNoRotate(point, true);
return new $.Point( return new $.Point(
topLeft.x * $.pixelDensityRatio, vpPoint.x * $.pixelDensityRatio,
topLeft.y * $.pixelDensityRatio vpPoint.y * $.pixelDensityRatio
); );
}, },