Description
I took a stab at updating the selection widgets. Namely, improving the RectangleSelector
and LassoSelector
, and adding new EllipseSelector
, PaintSelector
and LineSelector
widgets. These are based on a proof of concept I made called image inspector, which in turn is based on the scikit-image canvastools.
I created a gist that demonstrates all the widgets.
Improvements to RectangleSelector
:
- Visible handles for manipulating the shape after it has been drawn
- Keyboard modifiers:
- Alt moves the existing shape (as does dragging the center handle)
- Shift makes the shape square (or circular)
- Ctrl makes the initial point the center of the shape (helpful for ellipses)
- Ctrl and shift can be combined
- When
drawmode == 'line'
, actually draw the outline instead of a single line
The API is the same, but the default drawmode
has been changed to 'patch'
, while allowing 'box'
to alias to 'patch'
. Also, the shape is no longer invisible after been drawn (so we can interact with it).
Improvements to LassoSelector
:
- Unified API with
RectangeSelector
- Keyboard modifier:
- Shift enables
polygon
mode where it draws straight lines
- Shift enables
Note that LassoSelector
had two methods that were renamed: onpress
-> press
and onrelease
-> release
. The old methods could be kept, and call the new methods while giving a deprecation warning.
Here is a screenshot of the Ellipse tool:
How would you like me to proceed? Throw them all into one PR?