mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
Inspector增加esc快捷键
This commit is contained in:
parent
a7801cccd1
commit
b6fe557408
@ -51,11 +51,32 @@ export default defineComponent({
|
|||||||
const idx = Math.floor(Math.random() * arr.length);
|
const idx = Math.floor(Math.random() * arr.length);
|
||||||
return arr[idx];
|
return arr[idx];
|
||||||
}
|
}
|
||||||
|
document.addEventListener(
|
||||||
|
"keydown",
|
||||||
|
(e: KeyboardEvent) => {
|
||||||
|
if ((e.key === "Escape" || e.keyCode === 27) && picking.value === false) {
|
||||||
|
doInspector();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
const store = appStore();
|
const store = appStore();
|
||||||
store.init();
|
store.init();
|
||||||
const rnd = randomSupport();
|
const rnd = randomSupport();
|
||||||
const { config } = storeToRefs(appStore());
|
const { config } = storeToRefs(appStore());
|
||||||
|
function doInspector() {
|
||||||
|
ga(GA_EventName.GameInspector);
|
||||||
|
if (config.value.autoHide) {
|
||||||
|
showBtns.value = false;
|
||||||
|
}
|
||||||
|
picking.value = true;
|
||||||
|
if (typeof cc === "undefined") {
|
||||||
|
testInspector();
|
||||||
|
} else {
|
||||||
|
const event = new CustomEvent(DocumentEvent.GameInspectorBegan);
|
||||||
|
document.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
const listArray = ref<ListItem[]>([
|
const listArray = ref<ListItem[]>([
|
||||||
{
|
{
|
||||||
icon: `${rnd.icon} ani_shop_cart`,
|
icon: `${rnd.icon} ani_shop_cart`,
|
||||||
@ -112,20 +133,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "icon_target",
|
icon: "icon_target",
|
||||||
txt: "Inspect Game",
|
txt: "Inspect Game (esc)",
|
||||||
visible: true,
|
visible: true,
|
||||||
click: () => {
|
click: () => {
|
||||||
ga(GA_EventName.GameInspector);
|
doInspector();
|
||||||
if (config.value.autoHide) {
|
|
||||||
showBtns.value = false;
|
|
||||||
}
|
|
||||||
picking.value = true;
|
|
||||||
if (typeof cc === "undefined") {
|
|
||||||
testInspector();
|
|
||||||
} else {
|
|
||||||
const event = new CustomEvent(DocumentEvent.GameInspectorBegan);
|
|
||||||
document.dispatchEvent(event);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
contextmenu: (event: MouseEvent) => {
|
contextmenu: (event: MouseEvent) => {
|
||||||
const arr = [
|
const arr = [
|
||||||
@ -200,7 +211,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateAssistantTop(top: number) {
|
function updateAssistantTop(top: number) {
|
||||||
const root = toRaw(rootEl.value) as HTMLDivElement;
|
// @ts-ignore
|
||||||
|
const root = toRaw(rootEl.value) as HTMLDivElement | null;
|
||||||
if (!root) {
|
if (!root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -277,7 +289,8 @@ export default defineComponent({
|
|||||||
}, 500);
|
}, 500);
|
||||||
},
|
},
|
||||||
onMouseDown(event: MouseEvent) {
|
onMouseDown(event: MouseEvent) {
|
||||||
const root = toRaw(rootEl.value) as HTMLDivElement;
|
// @ts-ignore
|
||||||
|
const root = toRaw(rootEl.value) as HTMLDivElement | null;
|
||||||
if (!root) {
|
if (!root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user