Improved comments

This commit is contained in:
samhed 2013-07-11 12:37:01 +02:00
parent cf19ad3798
commit c6ad20992d
1 changed files with 5 additions and 6 deletions

View File

@ -548,17 +548,16 @@ function onMouseButton(e, down) {
} else { } else {
clearTimeout(doubleClickTimer); clearTimeout(doubleClickTimer);
// When the distance between the two touches is less than // When the distance between the two touches is small enough
// 20 physical pixels force the position of the latter touch // force the position of the latter touch to the position of
// to the position of the first. // the first.
var xs = lastTouchPos.x - pos.x; var xs = lastTouchPos.x - pos.x;
var ys = lastTouchPos.y - pos.y; var ys = lastTouchPos.y - pos.y;
var d = Math.sqrt((xs * xs) + (ys * ys)); var d = Math.sqrt((xs * xs) + (ys * ys));
// The devicePixelRatio is the ratio between logical pixels and // The goal is to trigger on a certain physical width, the
// physical pixels. A devicePixelRatio of 2 means that the // devicePixelRatio brings us a bit closer but is not optimal.
// physical linear resolution is double the logical resolution.
if (d < 20 * window.devicePixelRatio) { if (d < 20 * window.devicePixelRatio) {
pos = lastTouchPos; pos = lastTouchPos;
} }