resizeBy method

bool resizeBy(
  1. String id,
  2. double dw,
  3. double dh
)

Resizes an object by dw, dh.

Rectangles update width and height, circles update radius using the larger delta, lines move their end point, and text keeps position because text sizing is controlled by CanvasPaint.font.

Implementation

bool resizeBy(String id, double dw, double dh) {
  final object = objectById(id);
  if (object == null) return false;
  if (object.locked) return false;
  final resized = _constrainObject(
    object,
    _resizeObject(object, dw, dh, constraints: constraints),
  );
  final changed = update(id, resized);
  if (changed) onResize?.call(List.unmodifiable([resized]));
  return changed;
}