moveBy method

bool moveBy(
  1. String id,
  2. double dx,
  3. double dy
)

Moves an object by dx, dy.

Implementation

bool moveBy(String id, double dx, double dy) {
  final object = objectById(id);
  if (object == null) return false;
  if (object.locked) return false;
  final moved = _constrainObject(
    object,
    _snapObjectIfNeeded(_moveObject(object, dx, dy), id),
    moving: true,
  );
  final changed = update(id, moved);
  if (changed) onMove?.call(List.unmodifiable([moved]));
  return changed;
}