-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Zooming pin in and out does so at different rates #2341
Comments
Ha! Good find. |
While experimenting with this, I realized you don't need to make the pin very large to get the effect. any pin size would do. To make this extremely reproducible, I wrote the following bash to scroll up and down 5 steps at a time for 10 rounds: #!/usr/bin/env bash
round = 1
sleep 3s
for i in {1..10}
do
echo ${i}
xdotool click --repeat 5 --delay 20 5
xdotool click --repeat 5 --delay 20 4
sleep 1s
done In ideal world the size of the pin image should stay the same after scrolling up and down equal number of times and steps. So I created a large checkerboard pattern using https://eleif.net/checker.html and pinned one area and ran my code: Peek.2022-01-30.14-53.mp4
|
@mmahmoudian do you have any fractional scaling? |
No, all monitors are 100% |
So this is caused by rounding errors in the integer math. When the size is changed we add 15 to the width and the height. Then we ask Qt "please find resize the existing image to the new size while preserving the original aspect ratio". This is a destructive operation in the sense that it is nonlinear. So when you run it in reverse you end up with a different size even if you just increment once and decrement once. Once solution is to simply add or subtract by a multiple of the GCD, but i dont think this will be nice for very oblong images. The other solution I can think of is to store the original pixmap and original size. Then each mouse event will increment and decrement a counter. The counter will apply to the original pixmap each time. This will keep the operation linear. |
@borgmanJeremy I harmonize with the solution of storing a counter: incrementing and decrementing it can easily be made an exact and thus fully reversible operation. As a second remark: |
@Semnodime My first guess was that it was related to adding and removing percentages, but its actually not using percentages. flameshot/src/tools/pin/pinwidget.cpp Line 79 in 1cc5a26
I'll get to this in a few days if no one else does. I want to leave it open for new contributors for a few days since it should be straightforward. |
I'll take a look at this if you don't mind @borgmanJeremy |
@AndreaMarangoni sure, thanks! |
PR #2378 On the other hand, on Linux, I have noticed that the zooming in/out of the pinned screenshot sometimes jumps position on the screen. It looks like the position of the mouse cursor has something to do with this behaviour, but not sure yet. If I can reproduce it I will raise a ticket. |
Flameshot Version
v0.10.2 (c4081c6)
Installation Type
AppImage
Operating System type and version
Linux Mint 20.1 Cinnamon
Description
Scrolling in and out in a pin does so at different rates.
Scrolling to make it smaller is faster.
Only happens when the pin has been zoomed quite large already.
Steps to reproduce
Screenshots or screen recordings
None
System Information
s.a.
The text was updated successfully, but these errors were encountered: