Skip to content
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

How i can disable user moves? #15

Open
facku opened this issue Aug 16, 2020 · 2 comments
Open

How i can disable user moves? #15

facku opened this issue Aug 16, 2020 · 2 comments

Comments

@facku
Copy link

facku commented Aug 16, 2020

Hi, i need disable user moves feature. I need only programmatically moves.

@vitogit
Copy link
Owner

vitogit commented Aug 17, 2020

Probably I will add that option in a future version (maybe next month), for now I think you can create a new component that extend vue-chessboard (https://github.com/vitogit/vue-chessboard#extended-component-play-vs-random-ai) and use the chessground viewonly option.

  <script>
  import { chessboard }  from 'vue-chessboard'

  export default {
    name: 'newboard',
    extends: chessboard,
    mounted() {
      this.board.set({
        viewOnly: true
      })
    }
  }
  </script>

@jlincoln
Copy link

jlincoln commented Apr 1, 2021

I do this using a method that sets the state.movable.color attribute. It has the drawback of no longer allowing the user to scroll the page when pressing on the board though when run on a touch enabled device.

setBoardUnmovable: function() { this.$refs.echessboard.board.state.movable.color = ''; },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants