draw method
Draw the drawable components in this artboard.
Implementation
void draw(
Canvas canvas,
) {
canvas.save();
if (clip) {
if (_frameOrigin) {
canvas.clipRect(Rect.fromLTWH(0, 0, width, height));
} else {
canvas.clipRect(
Rect.fromLTWH(-width * originX, -height * originY, width, height));
}
}
// Get into artboard's world space. This is because the artboard draws
// components in the artboard's space (in component lingo we call this world
// space). The artboards themselves are drawn in the editor's world space,
// which is the world space that is used by stageItems. This is a little
// confusing and perhaps we should find a better wording for the transform
// spaces. We used "world space" in components as that's the game engine
// ratified way of naming the top-most transformation. Perhaps we should
// rename those to artboardTransform and worldTransform is only reserved for
// stageItems? The other option is to stick with 'worldTransform' in
// components and use 'editor or stageTransform' for stageItems.
if (_frameOrigin) {
canvas.translate(width * originX, height * originY);
}
for (final fill in fills) {
fill.draw(canvas, path);
}
for (var drawable = firstDrawable;
drawable != null;
drawable = drawable.prev) {
if (drawable.isHidden || drawable.renderOpacity == 0) {
continue;
}
drawable.draw(canvas);
}
canvas.restore();
}