Skip to content

Commit f20b5b5

Browse files
committed
try to lock focus on input
1 parent 2a4c419 commit f20b5b5

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed

src/keyboard.vue

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// input(type="text", v-model="keyboardText", v-if="!input")
44
.keyboard
55
.line(v-for="line in keySet", track-by="$index")
6-
span(v-for="key in line", track-by="$index", :class="getClassesOfKey(key)", v-text="getCaptionOfKey(key)", @click="clickKey(key)", :style="getKeyStyle(key)")
6+
span(v-for="key in line", track-by="$index", :class="getClassesOfKey(key)", v-text="getCaptionOfKey(key)", @click="clickKey(key)", @mousedown="mousedown", :style="getKeyStyle(key)")
77

88
</template>
99

@@ -32,7 +32,9 @@
3232
3333
data () {
3434
return {
35-
currentKeySet: "default"
35+
currentKeySet: "default",
36+
37+
inputScrollLeft: 0
3638
};
3739
},
3840
@@ -173,6 +175,13 @@
173175
return text;
174176
},
175177
178+
mousedown() {
179+
if (!this.input) return;
180+
181+
this.inputScrollLeft = this.input.scrollLeft;
182+
//console.log("mousedown: ", this.input.scrollLeft, this.input.scrollWidth, this.input.clientWidth);
183+
},
184+
176185
clickKey(key) {
177186
if (!this.input) return;
178187
@@ -274,7 +283,7 @@
274283
$width: 40;
275284
$height: 2.2em;
276285
$margin: 0.5em;
277-
$radius: 0.625em;
286+
$radius: 0.35em;
278287
279288
.vue-touch-keyboard {
280289
@@ -345,7 +354,7 @@
345354
}
346355
347356
&:active {
348-
transform: scale(.95);
357+
transform: scale(.98); // translateY(1px);
349358
color: #333;
350359
background-color: #d4d4d4;
351360
border-color: #8c8c8c;
@@ -358,6 +367,43 @@
358367
}
359368
360369
} // .key
370+
/*
371+
// Apple style
372+
.key {
373+
color: #aaa;
374+
//font: bold 9pt arial;
375+
background: #eff0f2;
376+
border-radius: 4px;
377+
border-top: 1px solid #ddd;
378+
box-shadow:
379+
inset 0 0 25px #e8e8e8,
380+
0 1px 0 #c3c3c3,
381+
0 2px 0 #c9c9c9,
382+
0 2px 3px #333;
383+
text-shadow: 0px 1px 0px #f5f5f5;
384+
385+
&.control {
386+
box-shadow:
387+
0 1px 0 #c3c3c3,
388+
0 2px 0 #c9c9c9,
389+
0 2px 3px #333;
390+
text-shadow: 0px 1px 0px #777;
391+
}
392+
393+
&:hover {
394+
color: #aaa;
395+
background-color: inherit;
396+
border-color: inherit;
397+
}
398+
399+
&:active {
400+
color: #888;
401+
background: #ebeced;
402+
transform: translateY(3px);
403+
box-shadow: inset 0 0 25px #ddd, 0 0 3px #333;
404+
border-top: 1px solid #eee;
405+
}
406+
}*/
361407
362408
.placeholder {
363409
flex: $width / 2;

src/layouts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
"caps": { keySet: "capsed", text: "Caps lock", width: 80, classes: "control"},
1010
"space": { key: " ", text: "Space", width: 180},
1111
"enter": { key: "\r\n", text: "Enter", width: 80, classes: "control"},
12-
"backspace": { func: "backspace", classes: "control backspace", width: 60},
12+
"backspace": { func: "backspace", classes: "control backspace", width: 65},
1313
"accept": { func: "accept", text: "Close", classes: "control featured"},
1414
"next": { func: "next", text: "Next", classes: "control featured"}
1515
},

0 commit comments

Comments
 (0)