summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-08-04 11:24:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-08-04 11:24:15 +0900
commit33d3d5c5705474ffbaef86399a9dfd44c7f5cfe5 (patch)
tree8e93543f89d293621e7d922b2aade1709a04b3df
parent:v: (diff)
downloadsharkey-33d3d5c5705474ffbaef86399a9dfd44c7f5cfe5.tar.gz
sharkey-33d3d5c5705474ffbaef86399a9dfd44c7f5cfe5.tar.bz2
sharkey-33d3d5c5705474ffbaef86399a9dfd44c7f5cfe5.zip
スライダーコントロールを追加するなど
-rw-r--r--src/client/app/common/views/components/games/reversi/reversi.room.vue24
-rw-r--r--src/docs/reversi-bot.ja.md25
2 files changed, 38 insertions, 11 deletions
diff --git a/src/client/app/common/views/components/games/reversi/reversi.room.vue b/src/client/app/common/views/components/games/reversi/reversi.room.vue
index 2f5c3cf816..d482f70765 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.room.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.room.vue
@@ -53,7 +53,7 @@
</div>
</div>
- <div class="card" v-if="form">
+ <div class="card form" v-if="form">
<header>
<span>%i18n:@settings-of-the-bot%</span>
</header>
@@ -65,7 +65,7 @@
:key="message.id"/>
<template v-for="item in form">
- <mk-switch v-if="item.type == 'button'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
+ <mk-switch v-if="item.type == 'switch'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
<div class="card" v-if="item.type == 'radio'" :key="item.id">
<header>
@@ -77,6 +77,16 @@
</div>
</div>
+ <div class="card" v-if="item.type == 'slider'" :key="item.id">
+ <header>
+ <span>{{ item.label }}</span>
+ </header>
+
+ <div>
+ <input type="range" :min="item.min" :max="item.max" :step="item.step || 1" v-model="item.value" @change="onChangeForm($event, item)"/>
+ </div>
+ </div>
+
<div class="card" v-if="item.type == 'textbox'" :key="item.id">
<header>
<span>{{ item.label }}</span>
@@ -214,7 +224,7 @@ export default Vue.extend({
this.connection.send({
type: 'update-form',
id: item.id,
- value: v
+ value: item.value
});
},
@@ -312,6 +322,14 @@ root(isDark)
&[data-none]
border-color transparent
+ &.form
+ > div
+ > .card + .card
+ margin-top 16px
+
+ input[type='range']
+ width 100%
+
.card
max-width 400px
border-radius 4px
diff --git a/src/docs/reversi-bot.ja.md b/src/docs/reversi-bot.ja.md
index cb273a1ce8..cf5a3e4178 100644
--- a/src/docs/reversi-bot.ja.md
+++ b/src/docs/reversi-bot.ja.md
@@ -96,8 +96,8 @@ y = Math.floor(pos / mapWidth)
フォームコントロールは、次のようなオブジェクトです:
```javascript
{
- id: 'button1',
- type: 'button',
+ id: 'switch1',
+ type: 'switch',
label: 'Enable hoge',
value: false
}
@@ -110,21 +110,21 @@ y = Math.floor(pos / mapWidth)
### フォームの操作を受け取る
ユーザーがフォームを操作すると、ストリームから`update-form`イベントが流れてきます。
イベントの中身には、コントロールのIDと、ユーザーが設定した値が含まれています。
-例えば、上で示したボタンをユーザーがオンにしたとすると、次のイベントが流れてきます:
+例えば、上で示したスイッチをユーザーがオンにしたとすると、次のイベントが流れてきます:
```javascript
{
- id: 'button1',
+ id: 'switch1',
value: true
}
```
### フォームコントロールの種類
-#### ボタン
-type: `button`
-ボタンを表示します。何かの機能をオン/オフさせたい場合に有用です。
+#### スイッチ
+type: `switch`
+スイッチを表示します。何かの機能をオン/オフさせたい場合に有用です。
##### プロパティ
-`desc` ... ボタンの詳細な説明。
+`desc` ... スイッチの詳細な説明。
#### ラジオボタン
type: `radio`
@@ -145,6 +145,15 @@ items: [{
}]
```
+#### スライダー
+type: `slider`
+スライダーを表示します。
+
+##### プロパティ
+`min` ... スライダーの下限。
+`max` ... スライダーの上限。
+`step` ... 入力欄で刻むステップ値。
+
#### テキストボックス
type: `textbox`
テキストボックスを表示します。ユーザーになにか入力させる一般的な用途に利用できます。