fix:修复预览扭转不生效

main
zhu.yawen 1 year ago
parent 510712ddbe
commit 1529a2a85e

@ -13,14 +13,7 @@
<div <div
v-for="chart in chartList" v-for="chart in chartList"
:key="chart.code" :key="chart.code"
:style="{ :style="getStyle(chart)"
position: 'absolute',
width: chart.w + 'px',
height: chart.h + 'px',
left: chart.x + 'px',
top: chart.y + 'px',
zIndex: chart.z || 0
}"
> >
<Configuration <Configuration
:config="chart" :config="chart"
@ -94,7 +87,7 @@ export default {
return this.config.fitMode || this.stateFitMode return this.config.fitMode || this.stateFitMode
}, },
fitSelector () { fitSelector () {
return this.config.fitSelector return this.config.fitSelector
}, },
pageLoading () { pageLoading () {
return this.$store.state.bigScreen.pageLoading return this.$store.state.bigScreen.pageLoading
@ -181,6 +174,28 @@ export default {
'changePageConfig', 'changePageConfig',
'changeChartConfig' 'changeChartConfig'
]), ]),
getStyle (chart) {
if (chart.perspective > 0) {
return {
position: 'absolute',
width: chart.w + 'px',
height: chart.h + 'px',
left: chart.x + 'px',
top: chart.y + 'px',
transform: `perspective(${chart.perspective}px) skew(${chart.skewX}deg, ${chart.skewY}deg) rotateX(${chart.rotateX}deg) rotateY(${chart.rotateY}deg) rotateZ(${chart.rotateZ}deg)`,
zIndex: chart.z || 0
}
}
return {
position: 'absolute',
width: chart.w + 'px',
height: chart.h + 'px',
left: chart.x + 'px',
top: chart.y + 'px',
transform: `skew(${chart.skewX}deg, ${chart.skewY}deg) rotateX(${chart.rotateX}deg) rotateY(${chart.rotateY}deg) rotateZ(${chart.rotateZ}deg)`,
zIndex: chart.z || 0
}
},
// //
openDataViewDialog (config) { openDataViewDialog (config) {
this.$refs.dataViewDialog.init(config) this.$refs.dataViewDialog.init(config)
@ -320,7 +335,7 @@ export default {
// //
if (pageConfig.fitMode === 'fitWidth') { if (pageConfig.fitMode === 'fitWidth') {
scaleX = this.innerWidth / w scaleX = this.innerWidth / w
// //
if (this.innerHeight > h) { if (this.innerHeight > h) {
translate = `${((this.innerWidth - w) / 2) / scaleX}px, ${((this.innerHeight - h) / 2) / scaleY}px` translate = `${((this.innerWidth - w) / 2) / scaleX}px, ${((this.innerHeight - h) / 2) / scaleY}px`
} else { } else {

Loading…
Cancel
Save