Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Image centering is buggy #24

Open
Dobby233Liu opened this issue Sep 1, 2023 · 2 comments
Open

Image centering is buggy #24

Dobby233Liu opened this issue Sep 1, 2023 · 2 comments

Comments

@Dobby233Liu
Copy link
Member

creation date = 2009-03-03T17:35:31.393-08:00

The "center image" in Anolis Resourcer doesn't calculate coordinates properly: when changing the zoom level the image is transformed relative to (0,0) rather than the center of the image itself. Also when centered and if the image is large enough it becomes impossible to see it all.

@Dobby233Liu
Copy link
Member Author

Dobby233Liu commented Sep 1, 2023

creation date = 2009-03-04T13:31:23.263-08:00

If you are interested in a quick fix, replace stuff in ZoomPictureBox.GetRectangle() with

retVal.X = (rect.Width - _image.Width) / Convert.ToInt32(2 * _zoom);
retVal.Y = (rect.Height - _image.Height) / Convert.ToInt32(2 * _zoom);

Note that you still relate to the form width/height, not the active draw area, which is smaller.
And you should also add a minimum allowed size for the form, like 640x320.

@Dobby233Liu
Copy link
Member Author

Dobby233Liu commented Sep 1, 2023

creation date = 2009-03-05T05:04:03.12-08:00

I thought of using that simple technique, but I'd like to stay "mathematically pure" and stick with the Transforms so I can also implement rotation and other nifty things you can do with Transform matrices.

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

No branches or pull requests

1 participant