Demo:修复鼠标移出小地图再松开后事件没有结束的问题
This commit is contained in:
parent
5c1e5f072c
commit
00f86fe167
@ -53,13 +53,16 @@ class MiniMap {
|
|||||||
let miniMapBoxScale = actWidth / rect.width
|
let miniMapBoxScale = actWidth / rect.width
|
||||||
let miniMapBoxLeft = (boxWidth - actWidth) / 2
|
let miniMapBoxLeft = (boxWidth - actWidth) / 2
|
||||||
let miniMapBoxTop = (boxHeight - actHeight) / 2
|
let miniMapBoxTop = (boxHeight - actHeight) / 2
|
||||||
// 视口框大小及位置
|
// 当前思维导图图形实际的宽高,即在缩放后的宽高
|
||||||
let _rectX = rect.x - (rect.width * scaleX - rect.width) / 2
|
|
||||||
let _rectX2 = rect.x2 + (rect.width * scaleX - rect.width) / 2
|
|
||||||
let _rectY = rect.y - (rect.height * scaleY - rect.height) / 2
|
|
||||||
let _rectY2 = rect.y2 + (rect.height * scaleY - rect.height) / 2
|
|
||||||
let _rectWidth = rect.width * scaleX
|
let _rectWidth = rect.width * scaleX
|
||||||
let _rectHeight = rect.height * scaleY
|
let _rectHeight = rect.height * scaleY
|
||||||
|
// 视口框大小及位置
|
||||||
|
let _rectWidthOffsetHalf = (_rectWidth - rect.width) / 2
|
||||||
|
let _rectHeightOffsetHalf = (_rectHeight - rect.height) / 2
|
||||||
|
let _rectX = rect.x - _rectWidthOffsetHalf
|
||||||
|
let _rectX2 = rect.x2 + _rectWidthOffsetHalf
|
||||||
|
let _rectY = rect.y - _rectHeightOffsetHalf
|
||||||
|
let _rectY2 = rect.y2 + _rectHeightOffsetHalf
|
||||||
let viewBoxStyle = {
|
let viewBoxStyle = {
|
||||||
left: 0,
|
left: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
:style="{ width: width + 'px' }"
|
:style="{ width: width + 'px' }"
|
||||||
@mousedown="onMousedown"
|
@mousedown="onMousedown"
|
||||||
@mousemove="onMousemove"
|
@mousemove="onMousemove"
|
||||||
@mouseup="onMouseup"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="svgBox"
|
class="svgBox"
|
||||||
@ -65,6 +64,7 @@ export default {
|
|||||||
this.$bus.$on('data_change', this.data_change)
|
this.$bus.$on('data_change', this.data_change)
|
||||||
this.$bus.$on('view_data_change', this.data_change)
|
this.$bus.$on('view_data_change', this.data_change)
|
||||||
this.$bus.$on('node_tree_render_end', this.data_change)
|
this.$bus.$on('node_tree_render_end', this.data_change)
|
||||||
|
window.addEventListener('mouseup', this.onMouseup)
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
window.removeEventListener('resize', this.setSize)
|
window.removeEventListener('resize', this.setSize)
|
||||||
@ -72,6 +72,7 @@ export default {
|
|||||||
this.$bus.$off('data_change', this.data_change)
|
this.$bus.$off('data_change', this.data_change)
|
||||||
this.$bus.$off('view_data_change', this.data_change)
|
this.$bus.$off('view_data_change', this.data_change)
|
||||||
this.$bus.$off('node_tree_render_end', this.data_change)
|
this.$bus.$off('node_tree_render_end', this.data_change)
|
||||||
|
window.removeEventListener('mouseup', this.onMouseup)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 切换显示小地图
|
// 切换显示小地图
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user