CIPowell/PhyloCanvas — pull request #5 by CIPowell (2014-01-20 15:19:53+00:00)
Title: Retina Support

Support added for Retina displays and other where pixel density is not 1 (i.e. some phone screens). This was necessary as it currently looked blurry on retina screens.

First Attempt to correct meant that the clicks were being pushed too far and left.

The fix translates the "click" from "page space" into "canvas space" by multiplying the position of the click by the pixel ratio then applying the canvas transforms.

e.g. user clicks at position (10, 10) on the canvas on a regular display... the position is also (10, 10) in canvas space. But on a retina display where the pixel ration is 2 the position on canvas space would be (20, 20).