Commit 82ff273
committed
Simplify CheckButtons and RadioButtons click handler.
Shorten the code that determines which button has been clicked.
Use Text.contains directly (it calls text.get_window_extent itself)
rather than manually going through text.get_window_extent.
The previous code for finding the closest click was actually wrong
(transAxes.inverted().transform((event.x, event.y)) is in axes space,
but get_offset_transform().transform(get_offsets()) is in screen space,
so they cannot be subtracted from one another) but it didn't really
matter because a click is, in practice, always contained by a single
button anyways (idxs has length at most 1). Still, fix that.1 parent 37f26da commit 82ff273
1 file changed
Lines changed: 16 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1134 | 1129 | | |
1135 | 1130 | | |
1136 | 1131 | | |
| |||
1656 | 1651 | | |
1657 | 1652 | | |
1658 | 1653 | | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
1663 | | - | |
1664 | | - | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
1671 | 1662 | | |
1672 | 1663 | | |
1673 | 1664 | | |
| |||
0 commit comments