javascript - Draw a cross at the mouses location on a canvas, non persistently -


I am obliged to this mausumov event of my canvas:

  function (e) {Var contDiv = $ ('# current_system_map'); Var offset = contDiv.offset (); X = e.clientX-offset.left; Y = e.clientY-offset.top; Context.beginPath (); Context.moveTo (0, y); Context.lineTo (595, y); Context.moveTo (x, 0); Context.lineTo (x, 595); Context.strokeStyle = "RGB (255255255)"; Context.stroke (); }  

And it works fine at one point. The drawn cross is constant, so when the mouse moves a new cross, the old one lives. I have tried to redraw the canvas inevitably, but it can get a cross and is quite far behind the mouse.

So I should know how to draw a cross and without having to be displayed it on the canvas again to attract everything.

Usually if you draw something on the canvas, then you can redraw the canvas material to erase it. I suggest that you use an image element as a cursor and place it at the top of

or you can try the old tricks and With the globalcomposite operator = 'xor' you can drag the cursor in the canvas. , Then erase it again in one place. After this you will need to restore the globalCompositeOperation to source-over .


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -