Javis.jl
Javis.jl copied to clipboard
Add mouse coordinates display in live viewer
PR Checklist
If you are contributing to Javis.jl, please make sure you are able to check off each item on this list:
- [ ] Did I update
CHANGELOG.mdwith whatever changes/features I added with this PR? - [x] Did I make sure to only change the part of the file where I introduced a new change/feature?
- [x] Did I cover all corner cases to be close to 100% test coverage (if applicable)?
- [x] Did I properly add Javis dependencies to the
Project.toml+ set an upper bound of the dependency (if applicable)? - [x] Did I properly add test dependencies to the
testdirectory (if applicable)? - [x] Did I check relevant tutorials that may be affected by changes in this PR?
- [x] Did I clearly articulate why this PR was made the way it was and how it was made?
Demo
Link to relevant issue(s) Closes #177
How did you address these issues with this PR? What methods did you use?
Added the mouse coordinates into a Gtklabel. There were 2 ways to do this.
- Use a
Gtk.EventBox(then add the canvas to it) and enable thePOINTER_MOTIONevent in the event box. Then connect a callback to update the coordinates. - Make use of the property motion from the
Gtk.Canvasand add a callback for the update.
References:-
- https://stackoverflow.com/questions/58683788/gtk-how-to-detect-the-mouse-position-over-eventbox
- https://juliagraphics.github.io/Gtk.jl/latest/manual/canvas/
Codecov Report
Merging #326 (7120fa5) into master (4241ea1) will increase coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #326 +/- ##
=======================================
Coverage 96.17% 96.18%
=======================================
Files 21 21
Lines 1151 1154 +3
=======================================
+ Hits 1107 1110 +3
Misses 44 44
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/javis_viewer.jl | 98.24% <100.00%> (+0.09%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 4241ea1...7120fa5. Read the comment docs.
Looks great! Two things:
- Please round the pixel values otherwise it screws up the slider and buttons a bit when moving around with the mouse.
- I think users are more interested in the coordinates where the origin (center of the image) is 0, 0
@Wikunia thanks for the review, I made the changes.
Thanks we had a look at this yesterday and we would like to make it a bit clearer with x= ..., y = ... and maybe put it under the frame functionality or smaller and to the right instead of centered.
Anything else we wanted @TheCedarPrince ?