mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 图表缩略图缩放比例优化
This commit is contained in:
parent
d7a9fc0e28
commit
f6a8c921f1
@ -66,6 +66,8 @@ export default defineComponent({
|
||||
const address = ref('')
|
||||
const slideId = ref('')
|
||||
|
||||
slideId.value = slides.value[0].id
|
||||
|
||||
const selectedSlide = computed(() => {
|
||||
if (!slideId.value) return null
|
||||
|
||||
|
@ -23,9 +23,8 @@
|
||||
:outline="elementInfo.outline"
|
||||
/>
|
||||
<Chart
|
||||
:class="{ 'need-scale': needScaleSize }"
|
||||
:width="chartWidth"
|
||||
:height="chartHeight"
|
||||
:width="elementInfo.width * zoom"
|
||||
:height="elementInfo.height * zoom"
|
||||
:type="elementInfo.chartType"
|
||||
:data="elementInfo.data"
|
||||
:options="elementInfo.options"
|
||||
@ -33,6 +32,7 @@
|
||||
:gridColor="elementInfo.gridColor"
|
||||
:legends="elementInfo.data.legends"
|
||||
:legend="elementInfo.legend || ''"
|
||||
:style="{ zoom: 1 / zoom }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -59,17 +59,15 @@ export default defineComponent({
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
setup() {
|
||||
const slideScale = inject(injectKeySlideScale) || ref(1)
|
||||
|
||||
const needScaleSize = computed(() => slideScale.value < 1)
|
||||
const chartWidth = computed(() => needScaleSize.value ? props.elementInfo.width * 10 : props.elementInfo.width)
|
||||
const chartHeight = computed(() => needScaleSize.value ? props.elementInfo.height * 10 : props.elementInfo.height)
|
||||
const zoom = computed(() => needScaleSize.value ? 1 / slideScale.value : 1)
|
||||
|
||||
return {
|
||||
needScaleSize,
|
||||
chartWidth,
|
||||
chartHeight,
|
||||
zoom,
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -87,7 +85,4 @@ export default defineComponent({
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.need-scale {
|
||||
zoom: .1;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user