-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow clicking source and destination to move piece, in addition to dragging and dropping. #138
base: master
Are you sure you want to change the base?
Conversation
…dition to dragging and dropping
Hi there! Is there any reason, why this pull request isn't merged yet? |
I think the repo is abandoned |
This project is not abandoned. |
The quick answer is that I haven't looked at it in depth. The longer answer is that "click to move" is complex and I haven't considered the impact it will have on the API. I don't think it will be as simple as this in terms of events firing, etc. |
Oh OK then. This was really only a small change I made for it to work with what I was doing, so that's understandable |
https://drive.google.com/file/d/1pzETCeASSfB1rUWuDxkddGisKz--ziRw/view I made a small changes of the original chessboard.js to move a piece by clicking only. |
A stepping stone towards this, that might be simpler is to just emit an event whenever a square is clicked. |
Chiming in from 2021 here, would really love this feature. Some people prefer to click, others to drag. But either way, it's very difficult on mobile to drag and very easy to click, and most internet traffic is mobile. I think anybody using chessboard.js on a larger project will need this feature and either 1) add it themselves, or 2) use another library That being said, I understand it's not as simple as clicking the merge PR button to add this, so take your time : ) |
@oakmac Would you be willing to add this feature to chessboard.js some time? I think it's just about necessary in order for anyone to play a game of chess on a mobile device (over half of the world wide web traffic is mobile) to move with clicking rather than dragging (which scrolls the page or requires a whole lot of finagling. |
Yes - I think this feature would be a good addition to the library. I do not have any plans to work on this right now (ie: working on this project compared to other things). In the meantime, I think it should be pretty doable to "hand code" this by adding a click event on the board square |
@oakmac Thank you for the response. I think it's a very important feature. Would you consider checking and merging the PR if @PINO was to make (an updated) one? (Or at least to emit an event when a square is clicked as @yarrichar suggested) |
@justingolden21 Hi, did you get the click and drag to work? |
@MBDani I haven't done any work on anything in chessboard.js. I'm currently just using it at https://justingolden.me/chess/ |
Hello, I would love to see this feature too. |
Any updates on this? |
It's been 6 years since this PR was opened... |
It would be important for iPads….Sent from my iPadFernando SemprunOn 5 Dec 2022, at 10:55, dav1312 ***@***.***> wrote:
This project is not abandoned.
It's been 6 years since this PR was opened...
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
I am also subscribed to this post and impatiently hoping for any update. @levi-rocha would it be possible for you to update your patch so we can use it unofficially? |
I have been working on chessboard2 recently, which will support "tap to move". |
I just commented line 1667 and it lets click to move but it repeats pieces when there is no previous piece selected. // if (!isDragging) return |
I added an event listener on each of the squares to allow this "click to move" behavior. It works for the most part. But if I flip the board via board.flip(), for whatever reason, the event listener on the square doesn't work anymore. I checked to see if the id on the divs were perhaps regenerated but they weren't. Any ideas? |
OK I think I found a fix. The function in the event listener was anonymous which for whatever reason caused the issue I described above. Not making it anonymous did the trick |
chessboard.js slightly modified to allow user to click a piece and a square in order to move that piece to that square, as opposed to only being able to move pieces by dragging and dropping. (Dragging and dropping still works as it did).