添加图表背景填充
This commit is contained in:
parent
706ccf5fc8
commit
73f7c758ef
|
@ -121,6 +121,7 @@ export interface PPTChartElement {
|
||||||
groupId?: string;
|
groupId?: string;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
|
fill?: string;
|
||||||
chartType: ChartType;
|
chartType: ChartType;
|
||||||
data: ChartData;
|
data: ChartData;
|
||||||
options?: ILineChartOptions & IBarChartOptions & IPieChartOptions;
|
options?: ILineChartOptions & IBarChartOptions & IPieChartOptions;
|
||||||
|
|
|
@ -203,6 +203,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '网格参考线',
|
text: '网格参考线',
|
||||||
|
handler: toggleGridLines,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '清空本页',
|
text: '清空本页',
|
||||||
|
|
|
@ -3,6 +3,21 @@
|
||||||
<Button class="full-width-btn" @click="chartDataEditorVisible = true">
|
<Button class="full-width-btn" @click="chartDataEditorVisible = true">
|
||||||
<IconEdit class="btn-icon" /> 编辑图表数据
|
<IconEdit class="btn-icon" /> 编辑图表数据
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div style="flex: 2;">背景填充:</div>
|
||||||
|
<Popover trigger="click">
|
||||||
|
<template #content>
|
||||||
|
<ColorPicker
|
||||||
|
:modelValue="fill"
|
||||||
|
@update:modelValue="value => updateFill(value)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<ColorButton :color="fill" style="flex: 3;" />
|
||||||
|
</Popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Divider />
|
||||||
<ElementOutline />
|
<ElementOutline />
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -23,7 +38,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, Ref, ref } from 'vue'
|
import { computed, defineComponent, Ref, ref, watch } from 'vue'
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
import { MutationTypes, State } from '@/store'
|
import { MutationTypes, State } from '@/store'
|
||||||
import { ChartData, PPTChartElement } from '@/types/slides'
|
import { ChartData, PPTChartElement } from '@/types/slides'
|
||||||
|
@ -31,12 +46,14 @@ import useHistorySnapshot from '@/hooks/useHistorySnapshot'
|
||||||
|
|
||||||
import ElementOutline from '../common/ElementOutline.vue'
|
import ElementOutline from '../common/ElementOutline.vue'
|
||||||
import ChartDataEditor from './ChartDataEditor.vue'
|
import ChartDataEditor from './ChartDataEditor.vue'
|
||||||
|
import ColorButton from '../common/ColorButton.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'chart-style-panel',
|
name: 'chart-style-panel',
|
||||||
components: {
|
components: {
|
||||||
ElementOutline,
|
ElementOutline,
|
||||||
ChartDataEditor,
|
ChartDataEditor,
|
||||||
|
ColorButton,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore<State>()
|
const store = useStore<State>()
|
||||||
|
@ -46,6 +63,13 @@ export default defineComponent({
|
||||||
|
|
||||||
const { addHistorySnapshot } = useHistorySnapshot()
|
const { addHistorySnapshot } = useHistorySnapshot()
|
||||||
|
|
||||||
|
const fill = ref<string>()
|
||||||
|
|
||||||
|
watch(handleElement, () => {
|
||||||
|
if(!handleElement.value) return
|
||||||
|
fill.value = handleElement.value.fill || '#000'
|
||||||
|
}, { deep: true, immediate: true })
|
||||||
|
|
||||||
const updateData = (data: ChartData) => {
|
const updateData = (data: ChartData) => {
|
||||||
chartDataEditorVisible.value = false
|
chartDataEditorVisible.value = false
|
||||||
const props = { data }
|
const props = { data }
|
||||||
|
@ -53,10 +77,18 @@ export default defineComponent({
|
||||||
addHistorySnapshot()
|
addHistorySnapshot()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateFill = (value: string) => {
|
||||||
|
const props = { fill: value }
|
||||||
|
store.commit(MutationTypes.UPDATE_ELEMENT, { id: handleElement.value.id, props })
|
||||||
|
addHistorySnapshot()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
chartDataEditorVisible,
|
chartDataEditorVisible,
|
||||||
handleElement,
|
handleElement,
|
||||||
updateData,
|
updateData,
|
||||||
|
fill,
|
||||||
|
updateFill,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
height: elementInfo.height + 'px',
|
height: elementInfo.height + 'px',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="element-content">
|
<div
|
||||||
|
class="element-content"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: elementInfo.fill,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<ElementOutline
|
<ElementOutline
|
||||||
:width="elementInfo.width"
|
:width="elementInfo.width"
|
||||||
:height="elementInfo.height"
|
:height="elementInfo.height"
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
height: elementInfo.height + 'px',
|
height: elementInfo.height + 'px',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="element-content">
|
<div
|
||||||
|
class="element-content"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: elementInfo.fill,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<ElementOutline
|
<ElementOutline
|
||||||
:width="elementInfo.width"
|
:width="elementInfo.width"
|
||||||
:height="elementInfo.height"
|
:height="elementInfo.height"
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="element-content"
|
class="element-content"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: elementInfo.fill,
|
||||||
|
}"
|
||||||
v-contextmenu="contextmenus"
|
v-contextmenu="contextmenus"
|
||||||
>
|
>
|
||||||
<ElementOutline
|
<ElementOutline
|
||||||
|
|
Loading…
Reference in New Issue