提交 6f7a8c56 authored 作者: wangjiahao's avatar wangjiahao

refactor: 组件在矩阵模式下增加最小宽高的限制

上级 2307af50
...@@ -539,6 +539,20 @@ export default { ...@@ -539,6 +539,20 @@ export default {
curGap() { curGap() {
return (this.canvasStyleData.panel.gap === 'yes' && this.element.auxiliaryMatrix) ? this.componentGap : 0 return (this.canvasStyleData.panel.gap === 'yes' && this.element.auxiliaryMatrix) ? this.componentGap : 0
}, },
miniWidth() {
return this.element.auxiliaryMatrix ? this.curCanvasScale.matrixStyleWidth * (this.element.miniSizex || 1) : 0
},
miniHeight() {
if (this.element.auxiliaryMatrix) {
if (this.element.component === 'de-number-range') {
return this.element.auxiliaryMatrix ? this.curCanvasScale.matrixStyleHeight * (this.element.miniSizey || 2) : 0
} else {
return this.element.auxiliaryMatrix ? this.curCanvasScale.matrixStyleHeight * (this.element.miniSizey || 1) : 0
}
} else {
return 0
}
},
...mapState([ ...mapState([
'editor', 'editor',
'curCanvasScale', 'curCanvasScale',
...@@ -1190,8 +1204,10 @@ export default { ...@@ -1190,8 +1204,10 @@ export default {
newH = restrictToBounds(newH, 0, this.parentHeight) newH = restrictToBounds(newH, 0, this.parentHeight)
} }
// 外部传参限制大小 // 外部传参限制大小
newW = restrictToBounds(newW, this.minW || 0, this.maxW) // newW = restrictToBounds(newW, this.minW || 0, this.maxW)
newH = restrictToBounds(newH, this.minH || 0, this.maxH) // newH = restrictToBounds(newH, this.minH || 0, this.maxH)
newW = restrictToBounds(newW, this.miniWidth || 0, this.maxW)
newH = restrictToBounds(newH, this.miniHeight || 0, this.maxH)
// 纵横比 // 纵横比
if (this.lockAspectRatio) { if (this.lockAspectRatio) {
// console.log(this.lockAspectRatio, this.aspectFactor) // console.log(this.lockAspectRatio, this.aspectFactor)
......
...@@ -102,6 +102,16 @@ export default { ...@@ -102,6 +102,16 @@ export default {
linkageInfo() { linkageInfo() {
return this.targetLinkageInfo[this.element.propValue.viewId] return this.targetLinkageInfo[this.element.propValue.viewId]
}, },
miniHeight() {
let miniHeight = this.curComponent.miniSizey || 1
if (this.element.component === 'de-number-range') {
miniHeight = this.curComponent.miniSizey || 2
}
return miniHeight
},
miniWidth() {
return this.curComponent.miniSizex || 1
},
...mapState([ ...mapState([
'menuTop', 'menuTop',
'menuLeft', 'menuLeft',
...@@ -146,6 +156,8 @@ export default { ...@@ -146,6 +156,8 @@ export default {
this.curComponent.y = Math.round(this.curComponent.style.top / this.curCanvasScale.matrixStyleOriginHeight) + 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.sizex = Math.round(this.curComponent.style.width / this.curCanvasScale.matrixStyleOriginWidth)
this.curComponent.sizey = Math.round(this.curComponent.style.height / this.curCanvasScale.matrixStyleOriginHeight) this.curComponent.sizey = Math.round(this.curComponent.style.height / this.curCanvasScale.matrixStyleOriginHeight)
this.curComponent.sizey = this.curComponent.sizey > this.miniHeight ? this.curComponent.sizey : this.miniHeight
this.curComponent.sizex = this.curComponent.sizex > this.miniWidth ? this.curComponent.sizex : this.miniWidth
this.curComponent.auxiliaryMatrix = true this.curComponent.auxiliaryMatrix = true
this.$emit('amAddItem') this.$emit('amAddItem')
} }
......
...@@ -939,7 +939,8 @@ export default { ...@@ -939,7 +939,8 @@ export default {
'curLinkageView', 'curLinkageView',
'doSnapshotIndex', 'doSnapshotIndex',
'componentGap', 'componentGap',
'mobileLayoutStatus' 'mobileLayoutStatus',
'curCanvasScale'
]) ])
}, },
watch: { watch: {
......
...@@ -11,6 +11,8 @@ export const BASE_MOBILE_STYLE = { ...@@ -11,6 +11,8 @@ export const BASE_MOBILE_STYLE = {
y: 1, y: 1,
sizex: 6, sizex: 6,
sizey: 4, sizey: 4,
miniSizex: 1,
miniSizey: 1,
auxiliaryMatrix: true auxiliaryMatrix: true
} }
...@@ -158,7 +160,9 @@ const list = [ ...@@ -158,7 +160,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 2 sizey: 2,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10002', id: '10002',
...@@ -181,7 +185,9 @@ const list = [ ...@@ -181,7 +185,9 @@ const list = [
textAlign: '', textAlign: '',
color: '', color: '',
backgroundColor: '' backgroundColor: ''
} },
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10003', id: '10003',
...@@ -199,7 +205,9 @@ const list = [ ...@@ -199,7 +205,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 6 sizey: 6,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10003-1', id: '10003-1',
...@@ -215,7 +223,9 @@ const list = [ ...@@ -215,7 +223,9 @@ const list = [
width: 600, width: 600,
height: 300, height: 300,
borderRadius: '' borderRadius: ''
} },
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10004', id: '10004',
...@@ -237,7 +247,9 @@ const list = [ ...@@ -237,7 +247,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 6 sizey: 6,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10005', id: '10005',
...@@ -256,7 +268,9 @@ const list = [ ...@@ -256,7 +268,9 @@ const list = [
y: 36, y: 36,
sizex: 10, sizex: 10,
sizey: 6, sizey: 6,
auxiliaryMatrix: true auxiliaryMatrix: true,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '10006', id: '10006',
...@@ -285,7 +299,9 @@ const list = [ ...@@ -285,7 +299,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 10 sizey: 10,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '30001', id: '30001',
...@@ -322,7 +338,9 @@ const list = [ ...@@ -322,7 +338,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 2 sizey: 2,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '20001', id: '20001',
...@@ -341,7 +359,9 @@ const list = [ ...@@ -341,7 +359,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 5 sizey: 5,
miniSizex: 1,
miniSizey: 1
}, },
{ {
id: '20002', id: '20002',
...@@ -360,7 +380,9 @@ const list = [ ...@@ -360,7 +380,9 @@ const list = [
x: 1, x: 1,
y: 1, y: 1,
sizex: 10, sizex: 10,
sizey: 5 sizey: 5,
miniSizex: 1,
miniSizey: 1
} }
] ]
......
...@@ -25,7 +25,9 @@ const drawPanel = { ...@@ -25,7 +25,9 @@ const drawPanel = {
}, },
value: '测试按钮' value: '测试按钮'
}, },
component: 'de-button' component: 'de-button',
miniSizex: 1,
miniSizey: 1
} }
class ButtonSureServiceImpl extends WidgetService { class ButtonSureServiceImpl extends WidgetService {
......
...@@ -34,7 +34,9 @@ const drawPanel = { ...@@ -34,7 +34,9 @@ const drawPanel = {
textAlign: '', textAlign: '',
color: '' color: ''
}, },
component: 'de-number-range' component: 'de-number-range',
miniSizex: 1,
miniSizey: 2
} }
class NumberRangeServiceImpl extends WidgetService { class NumberRangeServiceImpl extends WidgetService {
......
...@@ -24,7 +24,9 @@ const dialogPanel = { ...@@ -24,7 +24,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'tree-filter', defaultClass: 'tree-filter',
component: 'de-select-grid' component: 'de-select-grid',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -24,7 +24,9 @@ const dialogPanel = { ...@@ -24,7 +24,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'tree-filter', defaultClass: 'tree-filter',
component: 'de-select' component: 'de-select',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -19,7 +19,9 @@ const dialogPanel = { ...@@ -19,7 +19,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'text-filter', defaultClass: 'text-filter',
component: 'de-input-search' component: 'de-input-search',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -24,7 +24,9 @@ const dialogPanel = { ...@@ -24,7 +24,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'text-filter', defaultClass: 'text-filter',
component: 'de-select-grid' component: 'de-select-grid',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -24,7 +24,9 @@ const dialogPanel = { ...@@ -24,7 +24,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'text-filter', defaultClass: 'text-filter',
component: 'de-select' component: 'de-select',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -33,7 +33,9 @@ const dialogPanel = { ...@@ -33,7 +33,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'time-filter', defaultClass: 'time-filter',
component: 'de-date' component: 'de-date',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -44,7 +44,9 @@ const dialogPanel = { ...@@ -44,7 +44,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'time-filter', defaultClass: 'time-filter',
component: 'de-date' component: 'de-date',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -39,7 +39,9 @@ const dialogPanel = { ...@@ -39,7 +39,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'time-filter', defaultClass: 'time-filter',
component: 'de-date' component: 'de-date',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
...@@ -28,7 +28,9 @@ const drawPanel = { ...@@ -28,7 +28,9 @@ const drawPanel = {
textAlign: '', textAlign: '',
color: '' color: ''
}, },
component: 'de-quarter' component: 'de-quarter',
miniSizex: 1,
miniSizey: 1
} }
class TimeQuarterServiceImpl extends WidgetService { class TimeQuarterServiceImpl extends WidgetService {
......
...@@ -38,7 +38,9 @@ const dialogPanel = { ...@@ -38,7 +38,9 @@ const dialogPanel = {
manualModify: false manualModify: false
}, },
defaultClass: 'time-filter', defaultClass: 'time-filter',
component: 'de-date' component: 'de-date',
miniSizex: 1,
miniSizey: 1
} }
const drawPanel = { const drawPanel = {
type: 'custom', type: 'custom',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论