Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
vue-flow-editor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-07-15 11:13:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2f42445fece32397b7aa43249de4edca766d6186
2f42445f
1 parent
4a3fc1ec
预览展示页新增缩放工具
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
2 deletions
src/editor/vue-flow-editor-preview1.vue
src/editor/vue-flow-editor-preview1.vue
View file @
2f42445
<!--
* @Date: 2023-12-18 15:01:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
3-12-18 15:09:35
* @LastEditTime: 202
4-07-15 11:12:22
* @FilePath: /vue-flow-editor/src/editor/vue-flow-editor-preview1.vue
* @Description: 文件描述
-->
<template>
<transition name="vue-flow-editor-preview-transition">
<div class="vue-flow-editor-preview1" v-if="p_value">
<div class="vue-flow-editor-preview-body" ref="body">
<div class="vue-flow-editor-preview-body" ref="body"
style="overflow: scroll;"
>
<div class="vue-flow-editor-preview-target" ref="target"></div>
</div>
<div style="position: fixed; bottom: 1rem; right: 1rem; font-size: 25px;">
<div @click="zoomIn"><i class="el-icon-zoom-in"></i></div>
<div @click="zoomOut"><i class="el-icon-zoom-out"></i></div>
</div>
</div>
</transition>
</template>
...
...
@@ -40,12 +44,16 @@
return {
graph: null,
p_value: this.value,
currentHeight: 0,
currentWidth: 0,
}
},
methods: {
refresh() {
const container = this.$refs.target
const {offsetHeight, offsetWidth} = this.$refs.body
this.currentHeight = offsetHeight;
this.currentWidth = offsetWidth;
if (!!this.graph) {
this.graph.destroy()
...
...
@@ -71,6 +79,56 @@
this.p_value = false
this.$emit('input', this.p_value)
},
zoomIn() {
const container = this.$refs.target
this.currentWidth = this.currentWidth + 100;
this.currentHeight = this.currentHeight + 100;
if (!!this.graph) {
this.graph.destroy()
}
this.graph = new G6.Graph({
container,
width: this.currentWidth,
height: this.currentHeight,
...GraphStyle.default,
mode: {
default: [
'drag-canvas',
'zoom-canvas',
]
},
})
this.graph.read(this.data)
this.graph.fitView(20)
},
zoomOut() {
const container = this.$refs.target
this.currentWidth = this.currentWidth - 100;
this.currentHeight = this.currentHeight - 100;
if (!!this.graph) {
this.graph.destroy()
}
this.graph = new G6.Graph({
container,
width: this.currentWidth,
height: this.currentHeight,
...GraphStyle.default,
mode: {
default: [
'drag-canvas',
'zoom-canvas',
]
},
})
this.graph.read(this.data)
this.graph.fitView(20)
}
},
}
</script>
...
...
Please
register
or
login
to post a comment