/**
* Conversion between screen units (e.g. pixels) and real-world untis (e.g.
* inches). Automatically defines the CSS variables lens-dpmm (pixels per
* millimeter), lens-dpcm (pixels per centimeter), and lens-dpi (pixels per
* inch). Note that these are approximate: they are based on the width and
* height of the whole screen in pixels and millimeters, and may not be valid
* for non-flat surfaces. See {@link Coordinate} for transforming exact
* coordinates.
*
* @namespace
* @name Lens.Conversions
*/
define(["lib/jquery", "lib/underscore", "cgi-bin/dpmm"],
function($, _, dpmm) {
"use strict";
var CM_PER_MM = 10;
var IN_PER_MM = 25.4;
// initialize Conversions with dummy values: 1 pixel per millimeter
var Conversions = /** @lends Lens.Conversions */ {
/**
* Pixels (dots) per millimeter
* @type {Number}
*/
dpmm: dpmm,
/**
* Pixels (dots) per centimeter
* @type {Number}
*/
dpcm: dpmm * CM_PER_MM,
/**
* Pixels (dots) per inch
* @type {Number}
*/
dpi: dpmm * IN_PER_MM,
};
Lens._addMember(Conversions, "Conversions");
return Conversions;
});