wolfram mathematica - How to improve sensietivity of EventHandler to MouseDragged and MouseClicked events -
wolfram mathematica - How to improve sensietivity of EventHandler to MouseDragged and MouseClicked events -
using eventhandler, notice thinks dragging mouse, though clicking it.
here simple example
eventhandler[graphics[circle[{0, 0}, 1]], "mouseclicked" :> print["mouse clicked"], "mousedragged" :> print["mouse beingness dragged"] ]
when start clicking, though create sure mouse fixed , not moving, , maintain clicking, , looking @ print messages, 1 time in while see dragging message come out.
i understand can sensitive mouse (but have mouse), may mouse pad, os, , slight motion hand, might cause this.
i wanted inquire if seek , see if notice problem well, , if knows setting can in mathematica minimize this. looking alternative eventhandler set time or delay when decides mouse beingness dragged, see nothing.
here illustration output of on scheme when clicking after running above code
mouse beingness dragged mouse clicked mouse clicked mouse clicked mouse clicked mouse clicked mouse clicked mouse clicked mouse clicked mouse beingness dragged mouse clicked mouse clicked
this on windows 7, mathematica 8.0.1
thanks
the next not perfect, seems work better:
initmousepos = {-1, -1}; dragged = false; eventhandler[ dynamic@graphics[circle[{0, 0}, 1]], "mousedown" :> (initmousepos = mouseposition["graphics"]), "mouseup" :> if[euclideandistance[mouseposition["graphics"], initmousepos] < 2 10^-1, print["mouseclicked " <> tostring@mouseposition["graphics"]], sequence @@ {}], "mousedragged" :> if[euclideandistance[mouseposition["graphics"], initmousepos] > 2 10^-1, print["mouse beingness dragged " <> tostring@mouseposition["graphics"]], sequence @@ {}]]
wolfram-mathematica
Comments
Post a Comment