mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 21:44:57 +00:00
Node::strip_ruler_guides and Node::map_ruler_guide_positions asked a layer whether its whole subtree held a ruler guide, then asked each sublayer the same question again when filtering the children and again when the recursive call started. A layer nested d deep was tested 2d + 1 times, so a chain of N layers cost about N^2 layer tests. strip_ruler_guides runs when a document's objects are placed or pasted (Clipboard::from_document), when a copy of the document is saved (Document::guides_to_saved) and when a temporary editing layer is removed (Document::remove_edit_layer). map_ruler_guide_positions runs when an imported EPS is scaled. A new held_guides reads the layer once and records which children are ruler guides and which sublayers hold one; strip_held and map_held then visit and copy only those sublayers. The guides removed, the order f is called in, the art and its order, and the sharing of layers without a guide are the same as before. Neither method records an undo step.