vue-chessboard icon indicating copy to clipboard operation
vue-chessboard copied to clipboard

Free moves seem to be broken

Open staverm opened this issue 4 years ago • 1 comments

Setting free = true doesn't allow making moves that don't follow chess rules. We are implementing a board editor for creating chess puzzles and are in need of a "creative mode" for setting pieces to arbitrary squares.

Otherwise, great work!

staverm avatar Dec 22 '20 18:12 staverm

Thanks for the feedback, you are right. I don't have much time to update the library but I think I have a solution for your project. A board editor seems to be a little far from the initial goal of this library but you can extend the library, here is an example to make the free movements work

 // editor.vue
  <script>
  import { chessboard }  from 'vue-chessboard'

  export default {
    name: 'editor',
    extends: chessboard,
    mounted() {
      this.board.set({
        movable: {
          color: 'both',
          free: true,
          events: { after: undefined }
        }
      })
    }
  }
  </script>

Code ref: https://github.com/vitogit/vue-chessboard-examples#extended-component-simple-board-editor Check the last example https://vitogit.github.io/vue-chessboard-examples/

vitogit avatar Dec 22 '20 20:12 vitogit