提交 34c81b07 authored 作者: wangjiahao's avatar wangjiahao

feat(fix): 非自适应画布的 仪表盘展示时 超高显示滚动条,修复间隙不准问题

上级 a31b783a
...@@ -68,8 +68,4 @@ export default { ...@@ -68,8 +68,4 @@ export default {
.component { .component {
position: absolute; position: absolute;
} }
.gap_class{
padding:3px;
}
</style> </style>
...@@ -68,15 +68,13 @@ export default { ...@@ -68,15 +68,13 @@ export default {
if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = { style = {
width: '100%', background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
height: '100%', ...style
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`
} }
} else { } else if (this.canvasStyleData.panel.backgroundType === 'color') {
style = { style = {
width: '100%', background: this.canvasStyleData.panel.color,
height: '100%', ...style
background: this.canvasStyleData.panel.color
} }
} }
} }
...@@ -117,6 +115,7 @@ export default { ...@@ -117,6 +115,7 @@ export default {
changeStyleWithScale, changeStyleWithScale,
getStyle, getStyle,
restore() { restore() {
debugger
const canvasHeight = document.getElementById('canvasInfo').offsetHeight const canvasHeight = document.getElementById('canvasInfo').offsetHeight
const canvasWidth = document.getElementById('canvasInfo').offsetWidth const canvasWidth = document.getElementById('canvasInfo').offsetWidth
this.scaleWidth = canvasWidth * 100 / parseInt(this.canvasStyleData.width)// 获取宽度比 this.scaleWidth = canvasWidth * 100 / parseInt(this.canvasStyleData.width)// 获取宽度比
......
...@@ -97,8 +97,8 @@ export default { ...@@ -97,8 +97,8 @@ export default {
this.$emit('change', false) this.$emit('change', false)
}, },
resize() { resize() {
this.scaleWidth = window.innerWidth * 100 / parseInt(this.canvasStyleData.width)// 获取宽度比 this.scaleWidth = window.innerWidth * 100 / this.canvasStyleData.width// 获取宽度比
this.scaleHeight = window.innerHeight * 100 / parseInt(this.canvasStyleData.height)// 获取高度比 this.scaleHeight = window.innerHeight * 100 / this.canvasStyleData.height// 获取高度比
this.handleScaleChange() this.handleScaleChange()
}, },
restore() { restore() {
...@@ -123,7 +123,7 @@ export default { ...@@ -123,7 +123,7 @@ export default {
}, },
format(value, scale) { format(value, scale) {
return value * parseInt(scale) / 100 return value * scale / 100
}, },
handleScaleChange() { handleScaleChange() {
const componentData = deepCopy(this.componentDataSource) const componentData = deepCopy(this.componentDataSource)
......
...@@ -450,9 +450,9 @@ export default { ...@@ -450,9 +450,9 @@ export default {
format(value, scale) { format(value, scale) {
// 自适应画布区域 返回原值 // 自适应画布区域 返回原值
if (this.canvasStyleData.selfAdaption) { if (this.canvasStyleData.selfAdaption) {
return parseInt(value * parseInt(scale) / 100) return value * scale / 100
} else { } else {
return parseInt(value) return value
} }
}, },
changeScale() { changeScale() {
...@@ -479,8 +479,8 @@ export default { ...@@ -479,8 +479,8 @@ export default {
this.matrixStyle.width = this.outStyle.width / this.matrixCount.x this.matrixStyle.width = this.outStyle.width / this.matrixCount.x
this.matrixStyle.height = this.outStyle.height / this.matrixCount.y this.matrixStyle.height = this.outStyle.height / this.matrixCount.y
} }
this.scaleWidth = parseInt(this.outStyle.width * 100 / this.canvasStyleData.width) this.scaleWidth = this.outStyle.width * 100 / this.canvasStyleData.width
this.scaleHeight = parseInt(this.outStyle.height * 100 / this.canvasStyleData.height) this.scaleHeight = this.outStyle.height * 100 / this.canvasStyleData.height
this.$store.commit('setCurCanvasScale', this.$store.commit('setCurCanvasScale',
{ {
scaleWidth: this.scaleWidth, scaleWidth: this.scaleWidth,
......
...@@ -123,12 +123,12 @@ export default { ...@@ -123,12 +123,12 @@ export default {
}, },
format(value) { format(value) {
const scale = this.scale const scale = this.scale
return value * parseInt(scale) / 100 return value * scale / 100
}, },
getOriginStyle(value) { getOriginStyle(value) {
const scale = this.canvasStyleData.scale const scale = this.canvasStyleData.scale
const result = value / (parseInt(scale) / 100) const result = value / (scale / 100)
return result return result
}, },
......
...@@ -81,10 +81,10 @@ const data = { ...@@ -81,10 +81,10 @@ const data = {
}, },
setShapeStyle({ curComponent, canvasStyleData, curCanvasScale }, { top, left, width, height, rotate }) { setShapeStyle({ curComponent, canvasStyleData, curCanvasScale }, { top, left, width, height, rotate }) {
if (top || top === 0) curComponent.style.top = parseInt(canvasStyleData.selfAdaption ? (top * 100 / curCanvasScale.scaleHeight) : top) if (top || top === 0) curComponent.style.top = canvasStyleData.selfAdaption ? (top * 100 / curCanvasScale.scaleHeight) : top
if (left || left === 0) curComponent.style.left = parseInt(canvasStyleData.selfAdaption ? (left * 100 / curCanvasScale.scaleWidth) : left) if (left || left === 0) curComponent.style.left = canvasStyleData.selfAdaption ? (left * 100 / curCanvasScale.scaleWidth) : left
if (width || width === 0) curComponent.style.width = parseInt(canvasStyleData.selfAdaption ? (width * 100 / curCanvasScale.scaleWidth) : width) if (width || width === 0) curComponent.style.width = canvasStyleData.selfAdaption ? (width * 100 / curCanvasScale.scaleWidth) : width
if (height || height === 0) curComponent.style.height = parseInt(canvasStyleData.selfAdaption ? (height * 100 / curCanvasScale.scaleHeight) : height) if (height || height === 0) curComponent.style.height = canvasStyleData.selfAdaption ? (height * 100 / curCanvasScale.scaleHeight) : height
if (rotate || rotate === 0) curComponent.style.rotate = rotate if (rotate || rotate === 0) curComponent.style.rotate = rotate
// console.log('setShapeStyle:curComponent' + 'top:' + top + ';left:' + left + '====' + JSON.stringify(curComponent)) // console.log('setShapeStyle:curComponent' + 'top:' + top + ';left:' + left + '====' + JSON.stringify(curComponent))
}, },
......
...@@ -483,7 +483,7 @@ export default { ...@@ -483,7 +483,7 @@ export default {
}, },
getOriginStyle(value) { getOriginStyle(value) {
const scale = this.canvasStyleData.scale const scale = this.canvasStyleData.scale
const result = value / (parseInt(scale) / 100) const result = value / (scale / 100)
return result return result
}, },
restore() { restore() {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<!-- 仪表板预览区域--> <!-- 仪表板预览区域-->
<el-row class="panel-design-preview"> <el-row class="panel-design-preview">
<div ref="imageWrapper" style="width: 100%;height: 100%"> <div ref="imageWrapper" style="width: 100%;height: 100%">
<fullscreen style="background: none;height: 100%" :fullscreen.sync="fullscreen"> <fullscreen style="height: 100%;background: none" :fullscreen.sync="fullscreen">
<Preview v-if="showMain" :show-type="canvasStyleData.selfAdaption?'full':'width'" /> <Preview v-if="showMain" :show-type="canvasStyleData.selfAdaption?'full':'width'" />
</fullscreen> </fullscreen>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论