movableKey function

bool movableKey(
  1. DraftDocument d,
  2. SelectionKey key,
  3. ObjectGripProvider? objects
)

Whether the select tool may move or rotate key (spec 08 D16): false only for a root-level group that objects calls immovable. Everything else is decided where it always was (a fill or an attrib is skipped by the capture itself, spec 03 D4).

Implementation

bool movableKey(
    DraftDocument d, SelectionKey key, ObjectGripProvider? objects) {
  if (objects == null) return true;
  final node = d.tree[key.target];
  if (node is! GroupNode || node.parent != d.rootHandle) return true;
  return objects.movable(d, key.target);
}