shift method

MorphGlassOutline shift(
  1. Offset offset
)

The same outline moved by offset.

Implementation

MorphGlassOutline shift(Offset offset) {
  final merged = _merged;
  if (merged != null) {
    return MorphGlassOutline._merged([
      for (final box in merged.boxes) box.shift(offset),
    ], merged.spacing);
  }
  final shapes = _shapes;
  if (shapes != null) {
    return MorphGlassOutline._union(path.shift(offset), [
      for (final shape in shapes) shape.shift(offset),
    ]);
  }
  final field = _field?.shift(offset);
  // A merged-box field keeps the union path, not its fused edge.
  final edge = field is GlassBoxField ? null : field?.outline;
  return MorphGlassOutline._(
    edge ?? path.shift(offset),
    field,
    _cover?.shift(offset),
  );
}