vitogit / vue-chessboard

Chessboard vue component to load positions, create positions and see threats
http://vitomd.com/vue-chessboard-examples/
GNU General Public License v3.0
165 stars 49 forks source link

Free moves seem to be broken #24

Open staverm opened 3 years ago

staverm commented 3 years ago

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!

vitogit commented 3 years ago

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/