mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Fix textarea focus for touchscreens with keyboard (#30)
* check if touchscreen has mouse. * add inputMode to props. * fix formatting.
This commit is contained in:
@ -112,6 +112,9 @@
|
||||
@Prop()
|
||||
private readonly fps!: number
|
||||
|
||||
@Prop()
|
||||
private readonly hasMobileKeyboard!: boolean
|
||||
|
||||
get cursor(): string {
|
||||
if (!this.isControling || !this.cursorImage) {
|
||||
return 'default'
|
||||
@ -121,10 +124,6 @@
|
||||
return 'url(' + uri + ') ' + x + ' ' + y + ', default'
|
||||
}
|
||||
|
||||
get isTouchDevice(): boolean {
|
||||
return 'ontouchstart' in window || navigator.maxTouchPoints > 0
|
||||
}
|
||||
|
||||
mounted() {
|
||||
// register mouseup globally as user can release mouse button outside of overlay
|
||||
window.addEventListener('mouseup', this.onMouseUp, true)
|
||||
@ -386,7 +385,7 @@
|
||||
|
||||
onMouseEnter(e: MouseEvent) {
|
||||
// focus opens the keyboard on mobile (only for android)
|
||||
if (!this.isTouchDevice) {
|
||||
if (!this.hasMobileKeyboard) {
|
||||
this._textarea.focus()
|
||||
}
|
||||
|
||||
@ -678,7 +677,7 @@
|
||||
|
||||
public mobileKeyboardShow() {
|
||||
// skip if not a touch device
|
||||
if (!this.isTouchDevice) return
|
||||
if (!this.hasMobileKeyboard) return
|
||||
|
||||
this.kbdShow = true
|
||||
this.kbdOpen = false
|
||||
@ -690,7 +689,7 @@
|
||||
|
||||
public mobileKeyboardHide() {
|
||||
// skip if not a touch device
|
||||
if (!this.isTouchDevice) return
|
||||
if (!this.hasMobileKeyboard) return
|
||||
|
||||
this.kbdShow = false
|
||||
this.kbdOpen = false
|
||||
|
Reference in New Issue
Block a user