Returns a function that converts input viewport coordinate space to an output coordinate space.
// f() will convert from viewport to document coordinate spaceconst f = viewportToSpace('document');// {x:100,y:100} is viewport coordinate spacef(100,100); // Yields: { x, y } converted to document space Copy
// f() will convert from viewport to document coordinate spaceconst f = viewportToSpace('document');// {x:100,y:100} is viewport coordinate spacef(100,100); // Yields: { x, y } converted to document space
Or immediately invoke for one-off use:
viewportToSpace('document')(100,100); // Yields: { x, y } Copy
viewportToSpace('document')(100,100); // Yields: { x, y }
Returns a function that converts input viewport coordinate space to an output coordinate space.
Or immediately invoke for one-off use: