npm install @nextml/far-canvas
For example: translated 100'000'000px
away from the center (and a scaling of 1.5) and rendering the objects that far away:
- Images, rectangles and lines are all missaligned.
lineWidth=8px
is not rendered correctly.
const { far } = require("../lib.cjs/index.js");
const farAway = 100000000;
const context = far(canvas, {y: -farAway, scale: 2}).getContext("2d");
context.clearCanvas();
context.fillRect(32, farAway + 16, 128, 128);
context.canvas; // underlying canvas for which the default unit is pixels
context.s; // coordinate system
context.s.inv; // inverse coordinate system
...
const canvas = document.getElementById('far');
const farAway = 100000000;
const context = far.far(canvas, {y: -farAway, scale: 2}).getContext("2d");
...
npm run example
npm version patch | minor | major