Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] - Better Snap Points and Geometric analysis possible? #498

Open
0lm opened this issue Oct 14, 2023 · 9 comments · Fixed by #554
Open

[Feature request] - Better Snap Points and Geometric analysis possible? #498

0lm opened this issue Oct 14, 2023 · 9 comments · Fixed by #554

Comments

@0lm
Copy link

0lm commented Oct 14, 2023

Is this feature request related to a problem?

Half half I would say. The feature would make alot of work very convenient

Describe the best way to implement this.

Currently, Photo Demon's snap point system feels non-existend. Most of time, when I move objects, or want to add different images to a pre-created canvas size, I need to zoom in alot, to be even able to pull an image to the very corner of the canvas, without accidently pulling it too far away, so part of the image is out of the canvas

Is it possible to add a (better?) snap point system, where especially when you reach the canvas borders, it will hard snap immediately, needing you to pull again to overcome that hard snap? (similar to photoshop). And talking about snap points, is it possible to also add these geometric lines, which show you where the mid of the image is, or how far you are away from a certain object etc, while moving an object? So, I can, for example, snap added text boxes, or added images, in the mid of the canvas, or for example, two images, both same distance away from left and right canvas borders? Or two added images/text boxes on the same height level, or when resizing text boxes, to see, when it has the same size, by seeing these lines etc.

Im not sure how to describe it, but I hope you know how photoshop's snap system works. Then you will understand, I think. Im not sure if this is too much ask,, though. Not sure how hard/easy it is to implement a better/customizeable snap system.

EDIT: Just looked up some terms. I am referring to things like "snap to pixel", "snap to grid", or stuff like snapping to other objects on the canvas. But not sure how these distance measurment lines are called, though, when you move an object.

Thank you!

If this feature makes it into PhotoDemon, I am happy to add your name to PhotoDemon's contributor list. Please let me know what name (and optional website link) you'd like me to use.

@tannerhelland
Copy link
Owner

Great suggestion, @0lm. Thank you. I have added this to my short-term to-do list.

@0lm
Copy link
Author

0lm commented Apr 4, 2024

Gimp could give hints and ideas on how to approach this feature (in case there is hopefully still interest to add this feature) - because with upcoming Gimp 3.0 in the near future (already implemented in the pre-release preview versions, I think), they added a better snap point system with geometrical relations to other objects. And since Gimp is opensource, this could be a good starter point. Personally, I unfortunately have no idea how to code this. But I assume it is maybe a bit harder than it sounds like, based on how long Gimp needed to introduce this feature.

EDIT: Here a link to the feature description in Gimp:
https://www.gimp.org/news/2024/02/21/gimp-2-99-18-released/#new-snapping-options

tannerhelland added a commit that referenced this issue Apr 8, 2024
...when moving a layer.  It works well!

This behavior can be toggled via `View > Snap to canvas edges`.  Minimum snap distance can be set via `Tools > Options > Interface`.

Still TODO:

1) Snapping when resizing (not moving) a layer
2) Anything involving selection tools

Relates to #498.
@tannerhelland
Copy link
Owner

Thank you for the follow-up, @0lm ! I'm sorry progress on this issue has been slow.

I am working on snapping in a separate branch and snapping is now available when moving layers. I haven't solved snapping for selections yet, and snapping for layer resizing also remains to be solved. But progress is (slowly) being made.

I hope it won't be too much longer before snap features are merged to the main branch. Thank you for continuing to track this issue.

tannerhelland added a commit that referenced this issue Apr 11, 2024
Snap-to-canvas-edge now works on all four layer corners when resizing via the move tool.

Importantly, snapping also works when the layer has non-destructive rotation or skew applied!

Relates to #498
tannerhelland added a commit that referenced this issue Apr 11, 2024
Relates to #498

The `View` menu now provides a top-level `Snap` setting that lets the user toggle snapping completely on or completely off (without losing individual snap-to settings).

This matches Photoshop's behavior and is mapped to the same hotkey, `Ctrl+Shift+;`.
@tannerhelland tannerhelland linked a pull request Apr 19, 2024 that will close this issue
tannerhelland added a commit that referenced this issue Apr 19, 2024
Relates to #498, #539, #532, possibly others. Thank you to everyone who suggested this feature.

PhotoDemon can now automagically "snap" objects to common targets. Which targets are used for snapping can be set in the `View > Snap` to menu. Current options include canvas bounds, layers, and centerlines (e.g. the center of the document and layers). A master menu item (and associated hotkey) can quickly enable/disable all snapping behavior, if required.

The `Tools > Options < Interface` panel lets you set snap distance (in screen pixels, not image pixels - same as Photoshop). The current default is 8 screen pixels, which is the same as other photo editors.

Next up: I want to add an option to "view smart guides" (probably named something else in the final build). Photoshop uses this feature to show you which boundary is being snapped, as snapping can become confusing on images with many layers.
@tannerhelland tannerhelland added fixed (hopefully) and removed in-progress labels Apr 19, 2024
@tannerhelland
Copy link
Owner

Snapping support is now available in nightly builds. Thank you for your patience!

I will leave this issue open for a few days while I continue testing the feature. I also have a few more small snap-related enhancements I would like to add.

Thank you again for suggesting this feature. I hope it helps!

@tannerhelland tannerhelland reopened this Apr 20, 2024
@0lm
Copy link
Author

0lm commented Apr 21, 2024

Snapping support is now available in nightly builds. Thank you for your patience!

I will leave this issue open for a few days while I continue testing the feature. I also have a few more small snap-related enhancements I would like to add.

Thank you again for suggesting this feature. I hope it helps!

Just tested it, this is awesome. It makes so many things easier! And I read in #554 that you are also going to add a visualization feature (I assume it is those lines which show where the snap relates to when moving an object around?). Thank you for your efforts!

tannerhelland added a commit that referenced this issue Apr 25, 2024
Relates to #498 .

Like Photoshop, PhotoDemon can now overlay lines on the main canvas (when moving or resizing layers).  These lines show you which edge(s) are being snapped and what they are being snapped to.

This feature can be toggled from the `View > Show extras > Smart Guides` menu.  It is enabled by default on new installs.
@tannerhelland
Copy link
Owner

Yes, exactly right! As I type this, I am committing a "smart guides" feature and uploading a new nightly build. (This is also in the View menu, and when enabled it will draw a highlight along the edge(s) being snapped. It is enabled by default.)

I'm really happy with how this feature turned out, and hopefully future feature suggestions won't take me quite so long to implement 😅 Thank you for testing the snapping!

@0lm
Copy link
Author

0lm commented Apr 26, 2024

The new Snap Smart Guide is working very well, too! Just a question out of curiosity: Is it possible to expand the Snap Feature and the Smart Guide Feature, so, multiple distances between multiple objects can be shown and snapped? Like.. if I want 10 different objects to have exact the same distance from each other. Or 4 objects, one at top, bottom, left and right, all 4 having same distance from the main image edges. Basically, relative distances to each other, when it is about multiple objects - to place objects kind of symmetrically. Thank you for your efforts and no need to be sorry, you are doing this voluntarily and for free, your Life definitely has priority.

@tannerhelland
Copy link
Owner

Thank you for the kind words, @0lm . They are appreciated.

I am still trying to wrap my head around the "equidistant" snap feature in GIMP and Photoshop. I haven't fully figured out how to add a similar feature in PhotoDemon.

Similarly, it's hard to know how to show distance to a specific object. How would the user select which object they want to show distance to? I could have a dropdown where the user selects a "distance from" target, but that only works for a single object at a time... IDK, there are some trade-offs I'm still trying to figure out.

What I'd like to work on next is a feature to simply display distances to the edges of the main canvas when you're moving layers, like this:

image

I think this would be a helpful first step until I figure out how other software makes their "equidistant" snapping behavior work.

@0lm
Copy link
Author

0lm commented May 1, 2024

You suggestion is actually a really good alternative! Being able to see distance numbers definitely will be helpful, in case "equidistant" feature is too complicated to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants