TransformOrigin constructor

TransformOrigin(
  1. VoltronMap? transformOriginMap
)

Implementation

TransformOrigin(VoltronMap? transformOriginMap) {
  if (transformOriginMap == null) {
    return;
  }

  final alignX = transformOriginMap.get<double>('alignX') ??
      transformOriginMap.get<int>('alignX')?.toDouble() ??
      0.0;
  final alignY = transformOriginMap.get<double>('alignY') ??
      transformOriginMap.get<int>('alignY')?.toDouble() ??
      0.0;
  final offsetX = transformOriginMap.get<double>('offsetX') ??
      transformOriginMap.get<int>('offsetX')?.toDouble() ??
      0.0;
  final offsetY = transformOriginMap.get<double>('offsetY') ??
      transformOriginMap.get<int>('offsetY')?.toDouble() ??
      0.0;
  final newAlignment = Alignment(alignX, alignY);
  final newOffset = Offset(offsetX, offsetY);
  offset = newOffset;
  alignment = newAlignment;
}