Touch devices dragging problem
Hi Mr Chris Oakman,
I have noticed that when chessboard.js is viewed and used on a touch screen device, piece dragging becomes a problem - it is quite annoying because as you'd try to drag a certain piece, the entire view gets dragged and scrolls. And as a result, the piece you want to move doesn't end up at another board rank/file.
As a work-around I did the following via jQuery
jQuery('#chess_board').on('scroll touchmove touchend touchstart contextmenu', function(e){
e.preventDefault();
});
Hi marvinIsSacul, Where did you use the statement above? I'm pretty new to JS and JQuery and do not really know where should I place your code. Thanks, Jon.
After initializing the chess board.
Any updates on this bug? I've seen a couple of PRs for fixing it but no-one has looked at them and both now have conflicts against Master. We're moving to devices that have touch and are running into this issue so would be nice to fixed. Plus more and more devices are touch-enabled so would be a sensible feature to have.
I agree chessboard.js needs better support for touch devices. It has been in the back of my mind to update; just has not been a priority lately ;)
@marvinIsSacul thanks a lot, this solve the issue I was having.
If nothing works, a temporary way of making it work is using on touchstart, make the piece have absolutely position, move it at touch position every touch move and finally, on touchend, run a for loop checking every square and then see if the piece overlaps any, and if more that one, which one the most. Whew!
Is there a way to avoid having to drag pieces and instead just clicking on the squares?