文本框点击判断

This commit is contained in:
2025-08-23 03:21:18 +08:00
parent 5ceaa3b649
commit 819166bae0
2 changed files with 25 additions and 3 deletions

View File

@ -69,6 +69,17 @@ class TextBox extends Base {
that.textDom = dom; that.textDom = dom;
} }
async isClick(posi, id) {
let params = [
{
position: posi
},
id,
null
]
this.clickCallBack({ position: posi }, id, null)
}
async setHandeler(data) { async setHandeler(data) {
let that = this let that = this
@ -118,6 +129,16 @@ class TextBox extends Base {
async returnFun() { async returnFun() {
return this.handler return this.handler
} }
get onClick() {
return this.clickCallBack
}
set onClick(val) {
if (val && typeof val !== 'function') {
console.error('val:', val, '不是一个function')
} else {
this.clickCallBack = val
}
}
get show() { get show() {
return this.options.show return this.options.show
} }

View File

@ -436,6 +436,7 @@ class YJEarth {
textList[i].style['pointer-events'] = 'all' textList[i].style['pointer-events'] = 'all'
textList[i].querySelector('textarea').focus() textList[i].querySelector('textarea').focus()
_this.isLeftClick = true _this.isLeftClick = true
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
break; break;
} }
} }