Demo:修复存在多个外框时,激活某个外框时外框样式默认回填错误的问题
This commit is contained in:
parent
43c41e7ed2
commit
324652b1ba
@ -136,6 +136,14 @@ import Color from './Color.vue'
|
|||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { lineWidthList, borderDasharrayList } from '@/config'
|
import { lineWidthList, borderDasharrayList } from '@/config'
|
||||||
|
|
||||||
|
const defaultStyleConfig = {
|
||||||
|
radius: 5,
|
||||||
|
strokeWidth: 2,
|
||||||
|
strokeColor: '#0984e3',
|
||||||
|
strokeDasharray: '5,5',
|
||||||
|
fill: 'rgba(9,132,227,0.05)'
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Color
|
Color
|
||||||
@ -155,11 +163,7 @@ export default {
|
|||||||
top: 0
|
top: 0
|
||||||
},
|
},
|
||||||
styleConfig: {
|
styleConfig: {
|
||||||
radius: 5,
|
...defaultStyleConfig
|
||||||
strokeWidth: 2,
|
|
||||||
strokeColor: '#0984e3',
|
|
||||||
strokeDasharray: '5,5',
|
|
||||||
fill: 'rgba(9,132,227,0.05)'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -195,8 +199,12 @@ export default {
|
|||||||
// 取范围内第一个节点的外框样式
|
// 取范围内第一个节点的外框样式
|
||||||
const firstNode = parentNode.children[range[0]]
|
const firstNode = parentNode.children[range[0]]
|
||||||
const firstNodeOuterFrame = firstNode.getData('outerFrame')
|
const firstNodeOuterFrame = firstNode.getData('outerFrame')
|
||||||
Object.keys(firstNodeOuterFrame).forEach(key => {
|
Object.keys(this.styleConfig).forEach(key => {
|
||||||
this.styleConfig[key] = firstNodeOuterFrame[key]
|
if (typeof firstNodeOuterFrame[key] !== 'undefined') {
|
||||||
|
this.styleConfig[key] = firstNodeOuterFrame[key]
|
||||||
|
} else {
|
||||||
|
this.styleConfig[key] = defaultStyleConfig[key]
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// 获取外框的位置大小信息
|
// 获取外框的位置大小信息
|
||||||
const { x, y, width } = el.rbox()
|
const { x, y, width } = el.rbox()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user