Errors
Errors are thrown as JavaScript Errors whose message starts with nitro-ui-sketch:. Export methods reject their promise instead of throwing.
| Message | Thrown by | Cause |
|---|---|---|
colors must be 0xRRGGBBAA integers | Any API taking a colour | A colour that is not an integer from 0 to 0xFFFFFFFF. |
tool width must be above zero | tool prop, setInkingTool, setEraserTool | A width of zero, below zero, or not finite. |
zoom limits must satisfy 0 < minimum <= maximum | minimumZoom, maximumZoom | Inverted or non-positive zoom limits. |
content size must be finite and not negative | contentSize | A negative or non-finite size. |
viewport values must be finite | setViewport | NaN or infinite zoom, x or y. |
expected a Drawing created by nitro-ui-sketch | drawing prop, CanvasController.drawing | An object that is not a Drawing. |
expected a Stroke created by nitro-ui-sketch | removeStroke, setSelection | An object that is not a Stroke. |
the canvas view of this controller was released | Any CanvasController member | The canvas was unmounted. |
no canvas engine with id … | CanvasController.forEngine | Internal: the view's engine does not exist. |
a stroke needs at least one point | addStroke | An empty points array. |
stroke points must be finite | addStroke | A point with a NaN or infinite value. |
not a nitro-ui-sketch drawing | Drawing.fromData | Data that toData did not produce. |
drawing data is truncated | Drawing.fromData | Cut-off data. |
unsupported drawing version N | Drawing.fromData | Data in a format version this release can't read. |
export needs a rect with a positive size | toImage, toSvg, toPdf | An empty drawing without rect, or a rect of zero size. |
export scale must be above zero | toImage | A scale of zero, below zero, or not finite. |
export is capped at 8192 pixels on a side | toImage | rect times scale exceeds 8192 pixels. |
could not allocate a GPU surface for the export, could not read the rendered pixels back, could not encode the image | toImage | The GPU or encoder failed. |
could not create the SVG exporter | toSvg | The SVG writer failed. |
could not create the PDF document, could not start the PDF page, could not write the PDF | toPdf | The PDF writer failed. |
found no GPU to render with | Canvas, exports | No GPU device was available. |