Javis.jl icon indicating copy to clipboard operation
Javis.jl copied to clipboard

Add mouse coordinates display in live viewer

Open codejaeger opened this issue 4 years ago • 4 comments

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.md with 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 test directory (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

Screenshot 2021-04-10 at 11 28 57 PM

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.

  1. Use a Gtk.EventBox (then add the canvas to it) and enable the POINTER_MOTION event in the event box. Then connect a callback to update the coordinates.
  2. Make use of the property motion from the Gtk.Canvas and add a callback for the update.

References:-

  1. https://stackoverflow.com/questions/58683788/gtk-how-to-detect-the-mouse-position-over-eventbox
  2. https://juliagraphics.github.io/Gtk.jl/latest/manual/canvas/

codejaeger avatar Apr 10 '21 18:04 codejaeger

Codecov Report

Merging #326 (7120fa5) into master (4241ea1) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           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 data Powered by Codecov. Last update 4241ea1...7120fa5. Read the comment docs.

codecov[bot] avatar Apr 10 '21 18:04 codecov[bot]

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 avatar Apr 13 '21 10:04 Wikunia

@Wikunia thanks for the review, I made the changes.

codejaeger avatar Apr 16 '21 10:04 codejaeger

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 ?

Wikunia avatar May 23 '21 13:05 Wikunia