src/util/Util.js
/**
 * Convert the position to window units.
 *
 * @name module:util.to_win
 * @function
 * @public
 * @param {number[]} pos - the input position
 * @param {string} posUnit - the position units
 * @param {Window} win - the associated Window
 * @returns {number[]} the position in window units
 */
Convert the position to window units.
Convert the position to window units .
function to_win(pos, posUnit, win)
{
	const response = { origin: "util.to_win", context: "when converting a position to window units" };
	try
	{
		if (win._units === "pix")
		{
			return to_px(pos, posUnit, win);
		}
		if (win._units === "norm")
		{
			return to_norm(pos, posUnit, win);
		}
		if (win._units === "height")
		{
			return to_height(pos, posUnit, win);
		}
		throw `unknown window units: ${win._units}`;
	}
	catch (error)
	{
		throw Object.assign(response, { response, error });
	}
}
function to_win ( pos , posUnit , win ) { const response = { origin : "util.to_win" , context : "when converting a position to window units" } ; try { if ( win . _units === "pix" ) { return to_px ( pos , posUnit , win ) ; } if ( win . _units === "norm" ) { return to_norm ( pos , posUnit , win ) ; } if ( win . _units === "height" ) { return to_height ( pos , posUnit , win ) ; } throw ` ${ win . _units } ` ; } catch ( error ) { throw Object . assign ( response , { response , error } ) ; } }
Convert the position to window units.
Convert the position to window units .