mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
抽离刷新按钮组件,支持旋转一次和无限旋转
This commit is contained in:
parent
ef6fb9f517
commit
e47cf0d3c0
@ -1,22 +0,0 @@
|
|||||||
@keyframes rotate {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: rotate(-360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.refresh {
|
|
||||||
margin: 0 3px;
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover {
|
|
||||||
color: rgb(250, 207, 161);
|
|
||||||
}
|
|
||||||
&:active {
|
|
||||||
color: #ffaa00;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.refresh-rotate {
|
|
||||||
animation: rotate 1s linear infinite reverse;
|
|
||||||
}
|
|
@ -2,3 +2,9 @@ export const PanelMsg = {
|
|||||||
Show: "Show",
|
Show: "Show",
|
||||||
Hide: "Hide",
|
Hide: "Hide",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum RotateType {
|
||||||
|
None = "none",
|
||||||
|
One = "one",
|
||||||
|
Loop = "loop",
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<span>no games created by cocos creator found!</span>
|
<span>no games created by cocos creator found!</span>
|
||||||
<span>{{ msg }}</span>
|
<span>{{ msg }}</span>
|
||||||
</div>
|
</div>
|
||||||
<i class="fresh iconfont icon_refresh" @click="onBtnClickUpdatePage"></i>
|
<Refresh @click="onBtnClickUpdatePage"></Refresh>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -13,9 +13,11 @@ import { Msg, PluginEvent, ResponseSupportData } from "../../core/types";
|
|||||||
import { ga } from "../../ga";
|
import { ga } from "../../ga";
|
||||||
import { GA_Button } from "../../ga/type";
|
import { GA_Button } from "../../ga/type";
|
||||||
import { bridge } from "./bridge";
|
import { bridge } from "./bridge";
|
||||||
|
import Refresh from "./refresh.vue";
|
||||||
import { checkSupport } from "./util";
|
import { checkSupport } from "./util";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "find",
|
name: "find",
|
||||||
|
components: { Refresh },
|
||||||
setup(props) {
|
setup(props) {
|
||||||
bridge.on(Msg.ResponseSupport, (event: PluginEvent) => {
|
bridge.on(Msg.ResponseSupport, (event: PluginEvent) => {
|
||||||
let data: ResponseSupportData = event.data;
|
let data: ResponseSupportData = event.data;
|
||||||
@ -52,19 +54,5 @@ export default defineComponent({
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fresh {
|
|
||||||
cursor: pointer;
|
|
||||||
color: white;
|
|
||||||
font-size: 20px;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: #cef57b;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
color: #ffaa00;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<CCDock name="Hierarchy">
|
<CCDock name="Hierarchy">
|
||||||
<template v-slot:tab-name-before> </template>
|
<template v-slot:tab-name-before> </template>
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<i class="iconfont icon_refresh refresh" :class="{ 'refresh-rotate': freshAuto }" @click="onClickRefresh"></i>
|
<Refresh @click="onClickRefresh" :type="rotateType"></Refresh>
|
||||||
<div class="engine-version" v-if="engineVersion">Cocos Creator V{{ engineVersion }}</div>
|
<div class="engine-version" v-if="engineVersion">Cocos Creator V{{ engineVersion }}</div>
|
||||||
</template>
|
</template>
|
||||||
<CCInput style="flex: none" placeholder="enter keywords to filter" :data="filterText" v-if="false">
|
<CCInput style="flex: none" placeholder="enter keywords to filter" :data="filterText" v-if="false">
|
||||||
@ -18,6 +18,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ccui from "@xuyanfeng/cc-ui";
|
import ccui from "@xuyanfeng/cc-ui";
|
||||||
import { IUiMenuItem } from "@xuyanfeng/cc-ui/types/cc-menu/const";
|
import { IUiMenuItem } from "@xuyanfeng/cc-ui/types/cc-menu/const";
|
||||||
|
import { HandExpandOptions } from "@xuyanfeng/cc-ui/types/cc-tree/const";
|
||||||
import Mousetrap, { MousetrapInstance } from "mousetrap";
|
import Mousetrap, { MousetrapInstance } from "mousetrap";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { defineComponent, nextTick, onMounted, onUnmounted, ref, toRaw, watch } from "vue";
|
import { defineComponent, nextTick, onMounted, onUnmounted, ref, toRaw, watch } from "vue";
|
||||||
@ -26,15 +27,16 @@ import { ga } from "../../ga";
|
|||||||
import { GA_EventName } from "../../ga/type";
|
import { GA_EventName } from "../../ga/type";
|
||||||
import { bridge } from "./bridge";
|
import { bridge } from "./bridge";
|
||||||
import { Bus, BusMsg } from "./bus";
|
import { Bus, BusMsg } from "./bus";
|
||||||
|
import { RotateType } from "./const";
|
||||||
import { EngineData, TreeData } from "./data";
|
import { EngineData, TreeData } from "./data";
|
||||||
import GameInfo from "./game-info.vue";
|
import GameInfo from "./game-info.vue";
|
||||||
|
import Refresh from "./refresh.vue";
|
||||||
import { appStore } from "./store";
|
import { appStore } from "./store";
|
||||||
import { Timer } from "./timer";
|
import { Timer } from "./timer";
|
||||||
import { HandExpandOptions } from "@xuyanfeng/cc-ui/types/cc-tree/const";
|
|
||||||
const { CCTree, CCFootBar, CCDock, CCDialog, CCInput, CCButton, CCInputNumber, CCSelect, CCButtonGroup, CCCheckBox, CCColor, CCDivider } = ccui.components;
|
const { CCTree, CCFootBar, CCDock, CCDialog, CCInput, CCButton, CCInputNumber, CCSelect, CCButtonGroup, CCCheckBox, CCColor, CCDivider } = ccui.components;
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "hierarchy",
|
name: "hierarchy",
|
||||||
components: { CCButtonGroup, CCInput, CCTree, CCDock },
|
components: { Refresh, CCButtonGroup, CCInput, CCTree, CCDock },
|
||||||
setup() {
|
setup() {
|
||||||
const funcShowPlace = (data: EngineData) => {
|
const funcShowPlace = (data: EngineData) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@ -49,13 +51,13 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
const timer: Timer = new Timer();
|
const timer: Timer = new Timer();
|
||||||
timer.onWork = () => {
|
timer.onWork = () => {
|
||||||
freshAuto.value = true;
|
rotateType.value = RotateType.Loop;
|
||||||
config.value.refreshHirarchy = true;
|
config.value.refreshHirarchy = true;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
updateTree();
|
updateTree();
|
||||||
};
|
};
|
||||||
timer.onClean = () => {
|
timer.onClean = () => {
|
||||||
freshAuto.value = false;
|
rotateType.value = RotateType.None;
|
||||||
config.value.refreshHirarchy = false;
|
config.value.refreshHirarchy = false;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
};
|
};
|
||||||
@ -189,16 +191,15 @@ export default defineComponent({
|
|||||||
Bus.emit(BusMsg.SelectNode, uuid);
|
Bus.emit(BusMsg.SelectNode, uuid);
|
||||||
bridge.send(Msg.SelectNode, uuid);
|
bridge.send(Msg.SelectNode, uuid);
|
||||||
}
|
}
|
||||||
const freshAuto = ref(config.value.refreshHirarchy);
|
const rotateType = ref<RotateType>(RotateType.None);
|
||||||
|
if (config.value.refreshHirarchy) {
|
||||||
|
rotateType.value = RotateType.Loop;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
onClickRefresh() {
|
onClickRefresh() {
|
||||||
freshAuto.value = true;
|
|
||||||
updateTree();
|
updateTree();
|
||||||
setTimeout(() => {
|
|
||||||
freshAuto.value = false;
|
|
||||||
}, 1000);
|
|
||||||
},
|
},
|
||||||
freshAuto,
|
rotateType,
|
||||||
engineVersion,
|
engineVersion,
|
||||||
expandedKeys,
|
expandedKeys,
|
||||||
elTree,
|
elTree,
|
||||||
@ -331,7 +332,6 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@import "./common.less";
|
|
||||||
.left {
|
.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="right">
|
<div class="right">
|
||||||
<CCDock name="Inspector">
|
<CCDock name="Inspector">
|
||||||
<template v-slot:title>
|
<template v-slot:title>
|
||||||
<i class="iconfont icon_refresh refresh" :class="{ 'refresh-rotate': freshAuto }" @click="onClickRefresh"></i>
|
<Refresh :type="rotateType" @click="onClickRefresh"></Refresh>
|
||||||
</template>
|
</template>
|
||||||
<div class="inspector" @contextmenu.prevent.stop="onMenu">
|
<div class="inspector" @contextmenu.prevent.stop="onMenu">
|
||||||
<Properties v-if="treeItemData" :data="treeItemData"></Properties>
|
<Properties v-if="treeItemData" :data="treeItemData"></Properties>
|
||||||
@ -20,13 +20,15 @@ import { ga } from "../../ga";
|
|||||||
import { GA_EventName } from "../../ga/type";
|
import { GA_EventName } from "../../ga/type";
|
||||||
import { bridge } from "./bridge";
|
import { bridge } from "./bridge";
|
||||||
import { Bus, BusMsg } from "./bus";
|
import { Bus, BusMsg } from "./bus";
|
||||||
|
import { RotateType } from "./const";
|
||||||
import { NodeInfoData } from "./data";
|
import { NodeInfoData } from "./data";
|
||||||
|
import Refresh from "./refresh.vue";
|
||||||
import { appStore } from "./store";
|
import { appStore } from "./store";
|
||||||
import { Timer } from "./timer";
|
import { Timer } from "./timer";
|
||||||
import Properties from "./ui/propertys.vue";
|
import Properties from "./ui/propertys.vue";
|
||||||
const { CCDock } = ccui.components;
|
const { CCDock } = ccui.components;
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { Properties, CCDock },
|
components: { Properties, CCDock, Refresh },
|
||||||
setup() {
|
setup() {
|
||||||
function updateNodeInfo() {
|
function updateNodeInfo() {
|
||||||
if (selectedUUID) {
|
if (selectedUUID) {
|
||||||
@ -39,13 +41,13 @@ export default defineComponent({
|
|||||||
const { config } = storeToRefs(appStore());
|
const { config } = storeToRefs(appStore());
|
||||||
const timer = new Timer();
|
const timer = new Timer();
|
||||||
timer.onWork = () => {
|
timer.onWork = () => {
|
||||||
freshAuto.value = true;
|
rotateType.value = RotateType.Loop;
|
||||||
config.value.refreshInspector = true;
|
config.value.refreshInspector = true;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
updateNodeInfo();
|
updateNodeInfo();
|
||||||
};
|
};
|
||||||
timer.onClean = () => {
|
timer.onClean = () => {
|
||||||
freshAuto.value = false;
|
rotateType.value = RotateType.None;
|
||||||
config.value.refreshInspector = false;
|
config.value.refreshInspector = false;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
};
|
};
|
||||||
@ -104,16 +106,15 @@ export default defineComponent({
|
|||||||
ccui.footbar.showError(error, { title: "parse property error" });
|
ccui.footbar.showError(error, { title: "parse property error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const freshAuto = ref(config.value.refreshInspector);
|
const rotateType = ref<RotateType>(RotateType.None);
|
||||||
|
if (config.value.refreshInspector) {
|
||||||
|
rotateType.value = RotateType.Loop;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
freshAuto,
|
rotateType,
|
||||||
treeItemData,
|
treeItemData,
|
||||||
onClickRefresh() {
|
onClickRefresh() {
|
||||||
freshAuto.value = true;
|
|
||||||
updateNodeInfo();
|
updateNodeInfo();
|
||||||
setTimeout(() => {
|
|
||||||
freshAuto.value = false;
|
|
||||||
}, 1000);
|
|
||||||
},
|
},
|
||||||
onMenu(evnet: MouseEvent) {
|
onMenu(evnet: MouseEvent) {
|
||||||
const menus: IUiMenuItem[] = [];
|
const menus: IUiMenuItem[] = [];
|
||||||
@ -150,7 +151,6 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@import "./common.less";
|
|
||||||
.right {
|
.right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
78
cc-inspector/src/views/devtools/refresh.vue
Normal file
78
cc-inspector/src/views/devtools/refresh.vue
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="iconfont icon_refresh_one refresh" @animationend="onAnimationend" @click="onClick" :class="getClass()"></div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import ccui from "@xuyanfeng/cc-ui";
|
||||||
|
import { defineComponent, ref, watch } from "vue";
|
||||||
|
import { RotateType } from "./const";
|
||||||
|
const { CCButton } = ccui.components;
|
||||||
|
export default defineComponent({
|
||||||
|
name: "refresh",
|
||||||
|
components: { CCButton },
|
||||||
|
props: {
|
||||||
|
type: { type: String, default: RotateType.None },
|
||||||
|
},
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const rotateType = ref(props.type);
|
||||||
|
watch(
|
||||||
|
() => props.type,
|
||||||
|
(v) => {
|
||||||
|
rotateType.value = v;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
onAnimationend() {
|
||||||
|
rotateType.value = RotateType.None;
|
||||||
|
},
|
||||||
|
onClick() {
|
||||||
|
if (rotateType.value === RotateType.Loop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rotateType.value = RotateType.One;
|
||||||
|
},
|
||||||
|
getClass() {
|
||||||
|
if (rotateType.value === RotateType.Loop) {
|
||||||
|
return "refresh-rotate-loop";
|
||||||
|
}
|
||||||
|
if (rotateType.value === RotateType.One) {
|
||||||
|
return "refresh-rotate-one";
|
||||||
|
}
|
||||||
|
if (rotateType.value === RotateType.None) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
@keyframes rotate {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(-360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@time-loop: 1s;
|
||||||
|
@time-one: 0.4s;
|
||||||
|
|
||||||
|
.refresh {
|
||||||
|
margin: 0 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: rgb(250, 207, 161);
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
color: #ffaa00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refresh-rotate-loop {
|
||||||
|
animation: rotate @time-loop linear infinite reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-rotate-one {
|
||||||
|
animation: rotate @time-one linear 1 reverse;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user