enthought / enthought/enable

Component bounds shrink with repeated changes to aspect ratio.

Open
#93 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
C
Stars
97
Forks
45
PR merge metrics
No merged PRs in 30d

Description

`Component._enforce_aspect_ratio` rescales the component using [the most recent component bounds](https://github.com/enthought/enable/blob/master/enable/component.py#L1052) as an upper bound. As a result, repeatedly changing between low and high aspect ratios will shrink the component bounds to a point.

For example, run chaco's [aspect_ratio.py](https://github.com/enthought/chaco/blob/master/examples/demo/aspect_ratio.py) and click on the "Screen" (?) check box. Then, set the aspect ratio to 2, then 0.5, then 2, ... You should see a plot that shrinks to a point eventually.

Note that resizing the window (by dragging a corner of the window) will fix the plot bounds. This is because [resizing resets the bounds](https://github.com/enthought/enable/blob/master/enable/qt4/base_window.py#L53). These "maximum bounds" are never saved because `outer_bounds` (a.k.a. `outer_width` and `outer_height`) gets overwritten when figuring out the plot layout.

This will probably be fixed automatically if the layout gets rewritten to use
[constraints-based layouts](https://github.com/enthought/enable/pull/88).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.