Commit 384d4230 authored by 郭铭瑶's avatar 郭铭瑶 🤘

展开附属节点后提供一个短暂的自适配的力

parent c4768c68
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
/> />
<n-button type="primary" ghost @click="search">搜索</n-button> <n-button type="primary" ghost @click="search">搜索</n-button>
</n-input-group> </n-input-group>
<n-space> <n-space v-if="!isNarrow">
<n-tag v-show="nodeVal" size="small" round :color="color"> <n-tag v-show="nodeVal" size="small" round :color="color">
{{ switchName(nodeVal && nodeVal._label_key) }} {{ switchName(nodeVal && nodeVal._label_key) }}
</n-tag> </n-tag>
...@@ -188,6 +188,9 @@ export default defineComponent({ ...@@ -188,6 +188,9 @@ export default defineComponent({
return '未知' return '未知'
} }
} }
const isNarrow = computed(() => {
return window.innerHeight / window.innerWidth > 0.75
})
return { return {
curKey, curKey,
setKey, setKey,
...@@ -201,6 +204,7 @@ export default defineComponent({ ...@@ -201,6 +204,7 @@ export default defineComponent({
clear, clear,
nodeOptions, nodeOptions,
switchName, switchName,
isNarrow,
} }
}, },
}) })
...@@ -215,6 +219,7 @@ export default defineComponent({ ...@@ -215,6 +219,7 @@ export default defineComponent({
background #f8f9fb background #f8f9fb
box-shadow 10px 6px 10px 0 #000 box-shadow 10px 6px 10px 0 #000
margin-top 4px margin-top 4px
flex-wrap wrap
.search-bar .search-bar
flex 1 flex 1
margin 0 2% margin 0 2%
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
@search="searchNodes" @search="searchNodes"
/> />
</div> </div>
<n-drawer v-model:show="showDrawer" :width="400" placement="left"> <n-drawer v-model:show="showDrawer" :width="340" placement="left">
<n-drawer-content title="新增附属节点"> <n-drawer-content title="新增附属节点" closable>
<n-form ref="formRef" :model="formData" :rules="rules"> <n-form ref="formRef" :model="formData" :rules="rules">
<n-form-item path="propertyName" label="节点名称"> <n-form-item path="propertyName" label="节点名称">
<n-input <n-input
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
</n-form> </n-form>
</n-drawer-content> </n-drawer-content>
</n-drawer> </n-drawer>
<n-drawer v-model:show="showSubjectDrawer" :width="400" placement="left"> <n-drawer v-model:show="showSubjectDrawer" :width="340" placement="left">
<n-drawer-content title="新增主体"> <n-drawer-content title="新增主体" closable>
<n-form ref="subjectFormRef" :model="subjectData" :rules="rules"> <n-form ref="subjectFormRef" :model="subjectData" :rules="rules">
<n-form-item path="subjectName" label="名称"> <n-form-item path="subjectName" label="名称">
<n-input <n-input
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
</n-form> </n-form>
</n-drawer-content> </n-drawer-content>
</n-drawer> </n-drawer>
<n-drawer v-model:show="showLinkDrawer" :width="400" placement="left"> <n-drawer v-model:show="showLinkDrawer" :width="340" placement="left">
<n-drawer-content title="连接主体"> <n-drawer-content title="连接主体" closable>
<n-form ref="linkFormRef" :model="linkData" :rules="rules"> <n-form ref="linkFormRef" :model="linkData" :rules="rules">
<n-form-item path="sourceNodeId" label="源主体"> <n-form-item path="sourceNodeId" label="源主体">
<n-select <n-select
......
...@@ -418,10 +418,15 @@ export default class RelationGraph { ...@@ -418,10 +418,15 @@ export default class RelationGraph {
.alpha(1) .alpha(1)
.restart() .restart()
this.simulation.alphaTarget(0.3).restart()
this.curActiveNode.fx = this.curActiveNode.x
this.curActiveNode.fy = this.curActiveNode.y
const timer = setTimeout(() => { const timer = setTimeout(() => {
this.simulation.alphaTarget(0)
this.simulation.force('link', null) this.simulation.force('link', null)
clearTimeout(timer) clearTimeout(timer)
}, 200) }, 2000)
} }
openMenu(self, d, types) { openMenu(self, d, types) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment