Preserve aspect ratio when resizing
Brought to you by:
andreasb123,
auroux
To make the image patch even more useful, I've written this patch to allow the aspect ratio to be preserved when resizing selections. (It doesn't just apply to images.) Simply resize using the right mouse button (button-3) rather than the left mouse button.
This patch should be applied after the enhanced image patch. (Though it'd be easy enough to make the changes to the raw 0.4.5 source directly since it doesn't change any of the image patch related areas.)
Preserve aspect ratios when resizing selections
Has this patch been applied? I'm using Xournal 0.4.8, and I don't seem to have this functionality.
Thanks,
Deepee
No, the patch has not been applied to the official code base. The reason is that in my view, even though this is helpful to many, assigning this feature to button 3 (or any other proposed mechanism such as shift-clicking) is not a good user-interface choice for tablet users, and not particularly intuitive unless one has taken such a habit from extensive use of more advanced graphics editing software (which I do not want to assume of the user).
You can still apply the patch against the current version of xournal. (might need some adjustment to the line numbers in the code, but otherwise the code itself should still work just the same).
Hi Denis,
I'm having trouble aligning your patch with the source code in 0.4.8. For instance, I'm looking in xo-paint.c, and I can't find a line with update_cursor_for_resize(pt). Am I missing something?
Thanks,
Deepee
Oh, sorry -- the relevant code is now in src/xo-selection.c. So you
should modify the patch file to say xo-selection.c instead of
xo-paint.c, and then the line you are looking for is 349 (in the current
codebase; 348 in the original 0.4.8 release).
(The other code portion originally from xo-paint.c is also in
xo-selection.c now, so it should be straightforward after that).
Sorry for the oversight.
Denis
Thanks Denis,
Now I'm having a little trouble compiling the source. Do you know what's going on? I think I have installed all required dependencies.
Thanks,
Deepee
Strange... did your ./configure script come from running autogen.sh (or
similar) ? it should not contain any instance of PKG_CHECK_MODULES, this
should have been expanded into something else at a previous stage.
Either it is an issue with your installation of autoconf/automake, or it
is an issue with xournal's configure.in no longer being current ("works
for me" on an up to date Fedora, but who knows).
I'm not sure I know how to debug autoconf/automake issues, so... how
about getting a clean copy of the configure script that comes packaged
in xournal-0.4.8.2016.tar.gz, and skipping the autogen.sh stage of the
process but instead starting directly with the configure command?
Thanks,
Denis
Yes, I did run autogen.sh first. I will try starting from a clean configure script and see how it goes.
Thanks,
Deepee
Thanks Denis. In the absence of installing the patch, is there any other way to preserve the aspect ratio on resizing?
I'm afraid not. So I should take up this idea again and figure out
something to do with it.
Current thinking is that corner resize should 'snap' to preserve aspect
ratio if the user stays close enough to the correct location, and
otherwise not preserve; it should be a "one-sided" snap-to-aspect
feature, so that if e.g. I want to make the selection just a bit wider,
I can do so by first dragging well outside of the snapping area, then
return back all the way to the original aspect ratio before snapping
re-engages. Will try.
In any case, there is no feature in the current version, so you will
need to either install this patch or compile/install a new version when
one becomes available (don't hold your breath).
Denis
On 02/26/2018 09:26 AM, Deepee wrote:
--
Denis Auroux
UC Berkeley, Department of Mathematics
817 Evans Hall, Berkeley CA 94720-3840, USA
auroux@math.berkeley.edu
Related
Patches: #58
Thanks Denis. I'm not a tablet user, so I'd be happy with a feature that allows the user to right click on the image and check (or uncheck) "Preserve aspect ratio when resizing".
Thanks for your work on Xournal, and I will have a go at installing the patch.
Regards,
Deepee
we are carrying this patch in Gentoo for long time, can you please address this? Thanks!
Once again, this patch is not going into upstream as is. I for one use
button 3 as mapping for the selection tools (button 1 for drawing,
button 2 for erasing), which is the most intuitive setting for tablet
users with a side button on their pens. With this patch I and other
users with a similar workflow have to do a counter-intuitive sequence of
operations to resize freely.
I plan to be working on a better version of this feature shortly.
Denis
This feature has been reimplemented differently -- the resizing feature "snaps" to aspect-preserving when resizing by a corner. The selection frame turns red to indicate visually that the aspect ratio is locked.
This has just been committed to the GIT repository.
https://sourceforge.net/p/xournal/code/ci/07383c0374c644ca3728c9d1b954ec0fd120bc2d/
I am aware that if you were using this patch previously, it will now require a little bit more attention to aim the cursor in the correct general area to lock the aspect ratio. Hopefully not too much. But this will also allow tablet and touchscreen users to do aspect-preserving resizes...
Please test the new feature. Feedback welcome -- does it work for you, is it reasonably intuitive? is the snap too aggressive (engages when you didn't want it to / hard to disengage if engaged by accident) or not enough (too hard to resize with aspect ratio preserved in practice -- for small or for large selection boxes?). (With what type of input: mouse, finger, pen?) (And of course, let me know if you encounter a bug).
[I am aware that negative resizes can be considered aspect-preserving. This is neither a feature nor a bug.]
Denis
Can't get it working on 0.4.8
In most tools you use a modifier key to resize while preserving aspect ratio, so for instance press shift and drag to keep ratio, and drag without shift to resize to any size.
I understand this is inconvenient for tablet users. Do many people use Xournal on tablets?
Last edit: Lebowski 2019-12-20
thanks!
we will remove the downstream patch and will report feedback.