增加Inspector清理功能

This commit is contained in:
xu_yanfeng 2025-01-25 18:24:37 +08:00
parent 915f144986
commit 7ae3b5466a
3 changed files with 15 additions and 0 deletions

View File

@ -82,6 +82,8 @@ export enum GA_EventName {
GamePlayer = "game_player", GamePlayer = "game_player",
GamePause = "game_pause", GamePause = "game_pause",
GameStep = "game_step", GameStep = "game_step",
PickTop = "pick_top",
InspectorClear = "inspector_clear",
GameInspectorFilter = "game_inspector_filter", GameInspectorFilter = "game_inspector_filter",
/** /**
* store广告链接 * store广告链接

View File

@ -138,12 +138,21 @@ export default defineComponent({
}; };
}); });
ccui.menu.showMenuByMouseEvent(event, [ 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", name: "Pick Top",
selected: config.value.pickTop, selected: config.value.pickTop,
callback: (menu: IUiMenuItem) => { callback: (menu: IUiMenuItem) => {
config.value.pickTop = !config.value.pickTop; config.value.pickTop = !config.value.pickTop;
appStore().save(); appStore().save();
ga(GA_EventName.PickTop);
}, },
}, },
{ {

View File

@ -28,6 +28,10 @@ export class Hint {
private inspector: Inspector = null; private inspector: Inspector = null;
constructor(inspector: Inspector) { constructor(inspector: Inspector) {
this.inspector = inspector; this.inspector = inspector;
document.addEventListener(DocumentEvent.InspectorClear, () => {
this.cleanHover();
this.cleanSelected();
});
document.addEventListener(DocumentEvent.GameInspectorBegan, (event: CustomEvent) => { document.addEventListener(DocumentEvent.GameInspectorBegan, (event: CustomEvent) => {
const el = this.getTargetElement(); const el = this.getTargetElement();
if (!el) { if (!el) {