enthought / enthought/chaco

ZoomTool: bad behavior of aspect_ratio

Open
#191 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
305
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Hello,

I was trying to use the aspect_ratio keyword of ZoomTool and was expecting:
1) the blue overlay that show the box zoom to be forced to respect the aspect_ratio
2) the final zoomed view to correspond to the blue overlay

Unfortunately, while 1) is indeed the case, 2) is not. The zoom is actually done according to the mouse position at the time of unclicking. I think that is a bug since it implies that the aspect_ratio is not respected.

Looking at the file better_selecting_zoom.py, this is due to self._screen_end being set to (event.x, event.y) when entering _end_select on line 330. Because of that the appropriate value of self._screen_end that is set in selecting_mouse_move according to the aspect_ratio keyword is forgotten.

After commenting line 330 of file better_selecting_zoom.py, I obtain the exact behavior I was expecting.

A simple example is given here: https://github.com/SDiot/chaco_troubles/blob/master/ZoomTool_AspectRatio.py

I think that this is a bug and should be fixed. If it's not, please let me know why! :)

Thanks!

S.D.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.