getSpaceFromAlignment method
Implementation
Rect getSpaceFromAlignment(HelperAlignment align, ElementModel elementModel) {
var parentObject = context.findRenderObject()!;
var element = elementModel.element!;
// var translation = element.renderObject!.getTransformTo(parentObject).getTranslation();
var objectX = elementModel.offset!.dx;
var objectEndX = objectX + element.size!.width;
var objectY = elementModel.offset!.dy;
var objectEndY = objectY + element.size!.height;
var layerRect = parentObject.paintBounds;
switch (align) {
case HelperAlignment.top:
return Rect.fromLTWH(0, 0, layerRect.width, objectY);
case HelperAlignment.bottom:
return Rect.fromLTWH(0, objectEndY, layerRect.width, layerRect.height);
case HelperAlignment.left:
return Rect.fromLTWH(0, 0, objectX, layerRect.height);
case HelperAlignment.right:
return Rect.fromLTWH(
objectEndX, 0, layerRect.width - objectEndX, layerRect.height);
}
}