@mocanvas/editor · function

toDomPrecision

declare function toDomPrecision(v: number): number

Round to a sensible number of decimal places for the DOM. Sub-pixel detail beyond four places changes nothing on screen and only bloats the markup.

SEMANTICS-ASSUMED: four places. The docs name the function but not the precision; four is the finest that still collapses float dust.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.