From dadef91ce0c2a01079cd3076e2cff2cc2c6bc69d Mon Sep 17 00:00:00 2001 From: Yansong Hong Date: Fri, 7 Feb 2020 13:15:03 -0800 Subject: [PATCH] 1540 Address reviewer comment to better document viewportCoordToDrawerCoord function --- src/drawer.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/drawer.js b/src/drawer.js index 4cd7ee4b..acd0eb46 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -167,14 +167,17 @@ $.Drawer.prototype = { }, /** - * This function gets the top left point from the viewport using the pixel point - * @param {OpenSeadragon.Point} point - the pixel points to convert + * This function converts the given point from to the drawer coordinate by + * 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) { - var topLeft = this.viewport.pixelFromPointNoRotate(point, true); + var vpPoint = this.viewport.pixelFromPointNoRotate(point, true); return new $.Point( - topLeft.x * $.pixelDensityRatio, - topLeft.y * $.pixelDensityRatio + vpPoint.x * $.pixelDensityRatio, + vpPoint.y * $.pixelDensityRatio ); },