mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-28 09:21:55 +01:00
Taking objects out of a selection (select.toggle, which Shift-click, the Layers panel and a script's selected = false run) checked the whole selection again, walking the tree once it held more than an eighth of the document, and read every selected object's paints for the fill and stroke proxies. Deselecting N objects one at a time took O(N^2) lookups. Session::select now checks only the objects that follow the objects it already checked, kept in their order, so a removal needs no checks. The selection's paints keep counts (the first fill, stroke and weight met, how many match it, and how many there are), so the objects that leave are taken out of them and the objects that join are read. The paints are read again when every value matching the first one is gone and others are left, or when that takes fewer lookups.