html5 canvas hand cursor problems

后端 未结 3 1025
萌比男神i
萌比男神i 2020-12-15 08:16

I\'m playing around with html5 and some javascript to make a minor sketchpad. Whenever I click down on the canvas in chrome, the cursor becomes a text cursor. I have tried p

3条回答
  •  一整个雨季
    2020-12-15 08:58

    Use the disable text selection on the canvas. This works like a charm.

    var canvas = document.getElementById('canvas');
    canvas.onselectstart = function () { return false; } // ie
    canvas.onmousedown = function () { return false; } // mozilla
    

    Cheers, Kris

提交回复
热议问题