pythongosssss / ComfyUI-Custom-Scripts

Enhancements & experiments for ComfyUI, mostly focusing on UI features
MIT License
1.37k stars 104 forks source link

Save and restore the transformation matrix during exporting #265

Open liusida opened 1 month ago

liusida commented 1 month ago

Save and restore the transformation matrix. This ensures that visual properties and transformations are maintained across operations that require resizing or modifying the canvas. The update resolves issues related to unintended scaling and transformation resets when the canvas dimensions are programmatically changed.

Explanation: This line changes the canvas's property:

app.canvas.canvas.width = app.canvas.canvas.width;

This might at first lance seem like it should have no effect, but it actually does due to how the canvas element handles changes to its width and height properties.

liusida commented 1 month ago

fix #266

liusida commented 1 month ago

Tested on: Chrome Version 125.0.6422.141 (Official Build) (64-bit) Edge Version 125.0.2535.79 (Official build) (64-bit)