ImageNode.fromTopLeftWorld constructor
Creates an image node positioned by its axis-aligned world top-left corner.
This helper is AABB-based: rotation/shear affects boundsWorld, so
topLeftWorld is intended for UI-like positioning (selection box).
Implementation
factory ImageNode.fromTopLeftWorld({
required NodeId id,
required String imageId,
required Size size,
required Offset topLeftWorld,
Size? naturalSize,
double hitPadding = 0,
double opacity = 1,
bool isVisible = true,
bool isSelectable = true,
bool isLocked = false,
bool isDeletable = true,
bool isTransformable = true,
}) {
final centerWorld = topLeftWorld + Offset(size.width / 2, size.height / 2);
return ImageNode(
id: id,
imageId: imageId,
size: size,
naturalSize: naturalSize,
hitPadding: hitPadding,
transform: Transform2D.translation(centerWorld),
opacity: opacity,
isVisible: isVisible,
isSelectable: isSelectable,
isLocked: isLocked,
isDeletable: isDeletable,
isTransformable: isTransformable,
);
}