From 819166bae044d9afaf65ee0586eb67e9f10c8c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com> Date: Sat, 23 Aug 2025 03:21:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=A1=86=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Obj/Base/TextBox/index.js | 21 +++++++++++++++++++++ src/YJEarth/index.js | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js index 5c6f3da..bd8cfbc 100644 --- a/src/Obj/Base/TextBox/index.js +++ b/src/Obj/Base/TextBox/index.js @@ -69,6 +69,17 @@ class TextBox extends Base { that.textDom = dom; } + async isClick(posi, id) { + let params = [ + { + position: posi + }, + id, + null + ] + + this.clickCallBack({ position: posi }, id, null) + } async setHandeler(data) { let that = this @@ -118,6 +129,16 @@ class TextBox extends Base { async returnFun() { 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() { return this.options.show } diff --git a/src/YJEarth/index.js b/src/YJEarth/index.js index 6fc9060..775f153 100644 --- a/src/YJEarth/index.js +++ b/src/YJEarth/index.js @@ -62,9 +62,9 @@ class YJEarth { removeIncetance(id) { this.entityMap.delete(id) - unRegLeftClickCallback(this,id) - unRegRightClickCallback(this,id) - unregMoveCallback(this,id) + unRegLeftClickCallback(this, id) + unRegRightClickCallback(this, id) + unregMoveCallback(this, id) syncSplitData(this, id) } @@ -436,6 +436,7 @@ class YJEarth { textList[i].style['pointer-events'] = 'all' textList[i].querySelector('textarea').focus() _this.isLeftClick = true + _this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id) break; } }