applyMargin function
List<double>
applyMargin(
- AnchorMargin margin,
- List<
double> point, - double distance,
- MatrixOrientation orientation,
Implementation
List<double> applyMargin(AnchorMargin margin, List<double> point,
double distance, MatrixOrientation orientation) {
if (margin == AnchorMargin.none) return point;
if (orientation == MatrixOrientation.Horizontal &&
margin == AnchorMargin.start) return [point[0] - distance, point[1]];
if (orientation == MatrixOrientation.Vertical && margin == AnchorMargin.start)
return [point[0], point[1] - distance];
if (orientation == MatrixOrientation.Horizontal && margin == AnchorMargin.end)
return [point[0] + distance, point[1]];
if (orientation == MatrixOrientation.Vertical && margin == AnchorMargin.end)
return [point[0], point[1] + distance];
return point;
}