refactor: 增加视图的分布方式初始化数据

This commit is contained in:
wangjiahao 2021-10-09 18:22:11 +08:00
parent 009aebdee0
commit 6ceddf85e4
3 changed files with 12 additions and 3 deletions

View File

@ -15,10 +15,10 @@
<i v-if="activeModel==='edit'&&curComponent&&editFilter.includes(curComponent.type)" class="icon iconfont icon-edit" @click.stop="edit" />
</span>
<span :title="$t('panel.matrix')">
<i v-if="activeModel==='edit'&&curComponent.auxiliaryMatrix" class="icon iconfont icon-shujujuzhen" @click.stop="auxiliaryMatrixChange" />
<i v-if="activeModel==='edit'&&auxiliaryMatrix" class="icon iconfont icon-shujujuzhen" @click.stop="auxiliaryMatrixChange" />
</span>
<span :title="$t('panel.suspension')">
<i v-if="activeModel==='edit'&&!curComponent.auxiliaryMatrix" class="icon iconfont icon-xuanfuanniu" @click.stop="auxiliaryMatrixChange" />
<i v-if="activeModel==='edit'&&!auxiliaryMatrix" class="icon iconfont icon-xuanfuanniu" @click.stop="auxiliaryMatrixChange" />
</span>
<span :title="$t('panel.details')">
<i v-if="curComponent.type==='view'" class="icon iconfont icon-fangda" @click.stop="showViewDetails" />
@ -61,6 +61,7 @@ export default {
return {
componentType: null,
linkageActiveStatus: false,
auxiliaryMatrix: false,
editFilter: [
'view',
'custom'
@ -84,6 +85,9 @@ export default {
linkageInfo() {
return this.targetLinkageInfo[this.element.propValue.viewId]
},
mounted() {
this.auxiliaryMatrix = this.$store.state.curComponent.auxiliaryMatrix
},
...mapState([
'menuTop',
'menuLeft',
@ -108,12 +112,14 @@ export default {
this.curComponent.style.width = this.curComponent.sizex * this.curCanvasScale.matrixStyleOriginWidth
this.curComponent.style.height = this.curComponent.sizey * this.curCanvasScale.matrixStyleOriginHeight
this.curComponent.auxiliaryMatrix = false
this.auxiliaryMatrix = false
} else {
this.curComponent.x = Math.round(this.curComponent.style.left / this.curCanvasScale.matrixStyleOriginWidth) + 1
this.curComponent.y = Math.round(this.curComponent.style.top / this.curCanvasScale.matrixStyleOriginHeight) + 1
this.curComponent.sizex = Math.round(this.curComponent.style.width / this.curCanvasScale.matrixStyleOriginWidth)
this.curComponent.sizey = Math.round(this.curComponent.style.height / this.curCanvasScale.matrixStyleOriginHeight)
this.curComponent.auxiliaryMatrix = true
this.auxiliaryMatrix = true
}
this.$store.state.styleChangeTimes++
bus.$emit('auxiliaryMatrixChange')

View File

@ -94,6 +94,9 @@ const data = {
dragging: false,
resizing: false
}
if (!component.auxiliaryMatrix) {
component['auxiliaryMatrix'] = false
}
}
state.styleChangeTimes = 0
state.curComponent = component

View File

@ -13,7 +13,7 @@ export default {
props: {
drillFilters: {
type: Array,
required: true
default: () => []
}
},
data() {