mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-31 13:37:37 -06:00
layer.transform's fit / fitWidth / fitHeight ops took the layer's size from render::source_size, which returns (0, 0) for layers without a source item — shapes and text — so the ops matched nothing and silently did nothing, for the shortcut, the menu item and the command alike. When the source size is empty and a fit op runs, the size falls back to the layer's painted content bounds at the current time, and the anchor goes to the bounds' centre: content bounds live in layer space, where a shape is centred on the origin and text sits above its baseline, so (w/2, h/2) would fill the frame but land off-centre. Reset and the other ops keep the source size, so their defaults are unchanged. The regression test asserts what the viewer shows — the painted bounds mapped to comp space span [0, 0, 640, 360] after fit, and fitWidth spans the width centred vertically — for a rect shape and a text layer. Co-Authored-By: GLM-5.3-Flash <noreply@z.ai>