Skip to content

Commit

Permalink
add promote button
Browse files Browse the repository at this point in the history
ref: #9
  • Loading branch information
myokoym committed May 2, 2020
1 parent 17336c7 commit 4858bd1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions components/Shogiboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,24 @@
v-bind:is-before-hand="isBeforeHand"
></Hand>
<div>
<p>SFEN: <input
type="text"
size="66"
v-bind:value="value"
v-on:input="$emit('input', $event.target.value)"
></p>
<p>
<button
type="button"
v-on:click="reverseBoard()"
v-bind:class="{toggleButtonOn: reversed}"
>反転: {{reversed ? "ON" : "OFF"}}</button>
<button
type="button"
v-on:click="togglePromotedAndTurnOnButton()"
v-bind:disabled="beforeX === undefined"
>成る</button>
</p>
<p>SFEN: <input
type="text"
size="66"
v-bind:value="value"
v-on:input="$emit('input', $event.target.value)"
></p>
</div>
</div>
</template>
Expand Down Expand Up @@ -267,6 +272,12 @@ export default Vue.extend({
this.$emit('updateText', this.buildSfen())
this.$emit('send')
},
togglePromotedAndTurnOnButton() {
if (this.beforeX === undefined) {
return
}
this.togglePromotedAndTurn(this.beforeX, this.beforeY)
},
moveCell(x, y) {
if (this.beforeX === undefined && this.rows[y][x] !== ".") {
this.beforeX = x
Expand Down

0 comments on commit 4858bd1

Please sign in to comment.