From 7ae3b5466a0ed1074316ece62e7ee4117d904f2d Mon Sep 17 00:00:00 2001 From: xu_yanfeng Date: Sat, 25 Jan 2025 18:24:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Inspector=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cc-inspector/src/ga/type.ts | 2 ++ cc-inspector/src/scripts/inject-view/app.vue | 9 +++++++++ cc-inspector/src/scripts/inject/hint/index.ts | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/cc-inspector/src/ga/type.ts b/cc-inspector/src/ga/type.ts index 12c3946..6935a2f 100644 --- a/cc-inspector/src/ga/type.ts +++ b/cc-inspector/src/ga/type.ts @@ -82,6 +82,8 @@ export enum GA_EventName { GamePlayer = "game_player", GamePause = "game_pause", GameStep = "game_step", + PickTop = "pick_top", + InspectorClear = "inspector_clear", GameInspectorFilter = "game_inspector_filter", /** * 用户点击store广告链接 diff --git a/cc-inspector/src/scripts/inject-view/app.vue b/cc-inspector/src/scripts/inject-view/app.vue index f3fb1f4..2be1367 100644 --- a/cc-inspector/src/scripts/inject-view/app.vue +++ b/cc-inspector/src/scripts/inject-view/app.vue @@ -138,12 +138,21 @@ export default defineComponent({ }; }); ccui.menu.showMenuByMouseEvent(event, [ + { + name: "Clear", + callback: (menu: IUiMenuItem) => { + const event = new CustomEvent(DocumentEvent.InspectorClear); + document.dispatchEvent(event); + ga(GA_EventName.InspectorClear); + }, + }, { name: "Pick Top", selected: config.value.pickTop, callback: (menu: IUiMenuItem) => { config.value.pickTop = !config.value.pickTop; appStore().save(); + ga(GA_EventName.PickTop); }, }, { diff --git a/cc-inspector/src/scripts/inject/hint/index.ts b/cc-inspector/src/scripts/inject/hint/index.ts index 440b700..c287d52 100644 --- a/cc-inspector/src/scripts/inject/hint/index.ts +++ b/cc-inspector/src/scripts/inject/hint/index.ts @@ -28,6 +28,10 @@ export class Hint { private inspector: Inspector = null; constructor(inspector: Inspector) { this.inspector = inspector; + document.addEventListener(DocumentEvent.InspectorClear, () => { + this.cleanHover(); + this.cleanSelected(); + }); document.addEventListener(DocumentEvent.GameInspectorBegan, (event: CustomEvent) => { const el = this.getTargetElement(); if (!el) {