Skip to content
New issue

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

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

Already on GitHub? # to your account

Bug in TBaseImgPanel.RecenterImageAt() #130

Closed
CrustyLoaf opened this issue Jan 15, 2025 · 1 comment
Closed

Bug in TBaseImgPanel.RecenterImageAt() #130

CrustyLoaf opened this issue Jan 15, 2025 · 1 comment

Comments

@CrustyLoaf
Copy link

Hi,

If I'm not misunderstanding the purpose of this method, then I think it has a bug - it only works if both scrollbars are both currently at zero offset, and also only when called once (a second call with the same TPoint argument has strange behaviour).

The main problem is that the code doesn't take into account the current scrollbar offsets when applying the delta. Please see a suggested fix below which I tested with different scale factors (0.8, 1 and 2) and it works consistently. I hope this helps.

image
@AngusJohnson
Copy link
Owner

AngusJohnson commented Jan 16, 2025

Hi CrustyLoaf.
I've tried without success 😱 to make some sense of my own code, so it's almost by definition ugly.
However, while I've not spent enough time to make sense of your changes either, they make the code much simpler and it seems to work well too, so I'll happily include this in the next update. (And I can delete the pt1 variable and just use imagePt.)

AngusJohnson added a commit that referenced this issue Jan 16, 2025
Img32.Text   - function/method renaming (see comments) and other tweaks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants