Group-moving many prefab instances re-runs every script on drop #39

Open
opened 2026-08-23 11:40:08 +00:00 by ImBenji · 0 comments
Owner

Fallout from making placed instances real canvas objects (PrefabInstanceObjectData). They now share the canvas-object selection set, so a marquee can pick up a dozen at once - which is the point - but the move path regenerates each one when the drag is released.

A drag translates the instance and its generated children by the delta and skips Lua entirely, which is exact for any script that lays itself out relative to its own anchor. The drop then re-runs each selected instance's script so a script that reads absolute position still gets the last word. With one instance that is unnoticeable; with a marquee over many it is one full Lua run per instance, all on release.

Likely fix is to skip the re-run for instances whose script never touched its own anchor, so only the scripts that actually care pay for it. Deliberately not built upfront - wanted a measurement first rather than guessing at which scripts care. Related to #37, which is also about regenerate cost.

Sites: MapDataProvider.translateSelectedObjects (the per-instance regenerate loop at the end) and the group-move commit in pointer_handlers.dart.

Fallout from making placed instances real canvas objects (PrefabInstanceObjectData). They now share the canvas-object selection set, so a marquee can pick up a dozen at once - which is the point - but the move path regenerates each one when the drag is released. A drag translates the instance and its generated children by the delta and skips Lua entirely, which is exact for any script that lays itself out relative to its own anchor. The drop then re-runs each selected instance's script so a script that reads absolute position still gets the last word. With one instance that is unnoticeable; with a marquee over many it is one full Lua run per instance, all on release. Likely fix is to skip the re-run for instances whose script never touched its own anchor, so only the scripts that actually care pay for it. Deliberately not built upfront - wanted a measurement first rather than guessing at which scripts care. Related to #37, which is also about regenerate cost. Sites: MapDataProvider.translateSelectedObjects (the per-instance regenerate loop at the end) and the group-move commit in pointer_handlers.dart.
ImBenji added the enhancementarea:performance labels 2026-08-23 11:40:08 +00:00
ImBenji added this to the Arcs & Angles project 2026-08-23 11:40:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#39