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

Rework/push out #473

Open
wants to merge 22 commits into
base: release/1.3
Choose a base branch
from
Open

Conversation

FF-Brown
Copy link

Contains 3 related features: push out, snap to edge, and fit. All three are used by right-clicking an object on the surface (text box, shape, image, etc.) and selecting the option from the context menu.

Push out moves the object to one side (up, down, right, or left) of the current surface, and expands the surface to accommodate it. This allows the addition of captions on any side of a screenshot. It can also be used to place two or more screenshots side-by-side for comparison. While Greenshot does have the option to expand the surface, as far as I know it can only expand in all directions at once and must then be cropped to the desired size.

Snap to edge (or just, "Snap") moves an object so that one of its edges lines up with the desired edge of the surface. It is especially useful after expanding the surface. The user can push out one object and then snap other objects in the same direction to align them. It is also just a quick and easy way to move objects around.

Fit stretches an object to match either the width or the height of the surface. This is particularly useful when making captions. The user can make a text box, push it out (expanding the surface), then fit to either width or height, and they very quickly have a caption that is the right size and location for their image.

I believe these would be very useful features for Greenshot. I've seen at least 2-3 user requests for similar/same functionality.
This is my first time contributing so of course I'm happy to make any changes necessary to improve my implementation or conform to coding standards.
I believe the icons I used are from the same set as the rest of Greenshot's icons. If they won't work for some reason let me know.

@Christian-Schulz
Copy link
Contributor

An amazing feature.
I played around with it a bit. It is unfortunately possible to open the context menu without selecting an object. In this case you get an error.
Push_out

Yes, the real bug is that the context menu can be opened at all if nothing is selected.

@mischlrebl
Copy link
Contributor

very cool, happy to see it in a release soon!

@FF-Brown
Copy link
Author

It is unfortunately possible to open the context menu without selecting an object.

Ah good catch, I'll add a null check so that doesn't break until the context menu bug gets resolved. Or maybe I can deactivate these menu options when no objects are selected.

@FF-Brown
Copy link
Author

@Lakritzator I made these menu items only appear only if the current language has translations available. I get the feeling there may be a more correct way to do this than what I did (just a local variable indicating which languages are available). If so, just let me know what I need to do. For now, this will work if we update the list when translations get added, and later the condition can be removed entirely.

@FF-Brown
Copy link
Author

There is a (known) issue with pushing out or snapping objects that have a border. The current math doesn't account for border width, so borders tend to be cut off or stick out. If I remember correctly, only 1px borders work correctly. I wasn't able to figure out how to access the border thickness for a DrawableContainer to fix this issue. If somebody knows how to do that, please let me know.

That said, there are no issues with borderless objects such as images.
image

@Lakritzator
Copy link
Member

Wow, great stuff! I'm not quite sure if we got the right "flow" yet, because I hardly ever have this need, but it looks like a good extension. I do need to play around with it to have a good feeling about if this fits.

@Lakritzator I made these menu items only appear only if the current language has translations available. I get the feeling there may be a more correct way to do this than what I did (just a local variable indicating which languages are available). If so, just let me know what I need to do. For now, this will work if we update the list when translations get added, and later the condition can be removed entirely.
Translations are one of our weakness, I'll discuss this with the others. For now you did fine, it doesn't make sense to have a menu in a completely different language as the one which is selected.

One question, if we would make a completely different editor, I think this would be done completely different, right? e.g. having an infinite canvas, you would just drag the element where you need it...

@FF-Brown
Copy link
Author

Wow, great stuff! I'm not quite sure if we got the right "flow" yet, because I hardly ever have this need, but it looks like a good extension. I do need to play around with it to have a good feeling about if this fits.

I use these features a lot for making captions to go along with screenshots. imo it looks more professional when the caption is above/below/beside the screenshot and fits the width/height of the image. I also use it for making memes haha. It makes it really easy to stack images on top of each other or side-by-side.

One question, if we would make a completely different editor, I think this would be done completely different, right? e.g. having an infinite canvas, you would just drag the element where you need it...

Yeah, these would have to be at least adjusted if we had an infinite canvas. Push Out would be unnecessary at that point. Snap and Fit could still be useful, but they would need to be changed to specify a target object to snap to / match width or height.
imho these features are a good substitute for an infinite canvas.

As a sidenote, thanks for all your work on this project, Robin! It's an awesome tool and I use it all the time!

@FF-Brown
Copy link
Author

@Lakritzator would you like me to post some gifs demonstrating how I use the features?
I'm happy to do anything you think this needs to get approved 🙂

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.

None yet

4 participants