Skip to content

Conversation

@patrickas
Copy link
Contributor

This should make the selection tool work as expected

@patrickas
Copy link
Contributor Author

I am not happy with the way I made the stamp tool work, but I guess we can revert it when we someone implements the proper way.

Currently, when stamp tool is selected, and an image is selected, then just moving the cursor outside the boundary expands it.

The right way feels like it should be to:
1 - Always show the full preview of the image without ever clipping it even when the boundary is not expanded.
2 - On stamping, expand the canvas here and there to fit the image.

I will try working on that later if no one else has the time to, but initial trials did not seem promising 🤷‍♀️

@zero01101
Copy link
Owner

then just moving the cursor outside the boundary expands it

yeah, just selecting an image and simply moving the mouse all over a zoomed-out canvas (which is obviously not the intended use case lol) seems to spike up VRAM usage pretty easily too; probably less of an issue with browsers that aren't 3d-accelerated but that seems less and less likely these days... also, in doing that not-intended use case garbage above, it seems that the stamp tool actually kind of breaks after abusing it like i was doing - the stamp image disappears, fails to apply on click, and then new stamp selections don't visibly appear either :/

ezgif-5-e87680ab1c

@seijihariki
Copy link
Collaborator

I think we should only actually expand the canvas when drawing, and not for cursor overlay display...

…we are expanding to is currently wrong though
patrickas pushed a commit to patrickas/openOutpaint that referenced this pull request May 21, 2025
This commit continues the work from PR zero01101#180 to address issues with canvas expansion, particularly for the stamp tool, selection tool, and dream tool.

Key changes:
- Canvas expansion for the stamp tool now only occurs upon actual stamping (on click/draw), not during cursor movement. The bounding box calculation for expansion has been corrected to accurately reflect the stamp's dimensions and placement.
- Reviewed and confirmed that `js/lib/layers.js` correctly handles calls to `recalculateBg()`, only triggering it when the canvas dimensions actually change.
- Ensured that `js/ui/tool/select.js` and `js/ui/tool/dream.js` also follow the principle of expanding the canvas only when an action (like finalizing a selection or initiating image generation) necessitates it.

These changes aim to resolve issues where the canvas would expand excessively, leading to high VRAM usage and potential tool breakage, as discussed in PR zero01101#180. The overall behavior should now be more robust and user-friendly, with canvas expansion happening predictably and only when required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants