sort method

void sort({
  1. double pointToNumFunc(
    1. Vector3
    )?,
  2. double keyFunc(
    1. Mobject
    )?,
})

Implementation

void sort(
    {double Function(Vector3)? pointToNumFunc,
    double Function(Mobject)? keyFunc}) {
  var _pointToNumFunc = pointToNumFunc ?? (p) => p.x;
  var _keyFunc = keyFunc ?? (mob) => _pointToNumFunc(mob.getCenter());

  submobjects.sort((a, b) {
    return (_keyFunc(a) - _keyFunc(b)).sign.toInt();
  });
}