fix: 修复新建元素未应用主题

This commit is contained in:
pipipi-pikachu 2022-01-07 21:13:47 +08:00
parent ac2b267c99
commit 1cfd878f7a

View File

@ -27,7 +27,6 @@ export default () => {
const slidesStore = useSlidesStore() const slidesStore = useSlidesStore()
const { creatingElement } = storeToRefs(mainStore) const { creatingElement } = storeToRefs(mainStore)
const { theme, viewportRatio } = storeToRefs(slidesStore) const { theme, viewportRatio } = storeToRefs(slidesStore)
const { themeColor, fontColor, fontName } = theme.value
const { addHistorySnapshot } = useHistorySnapshot() const { addHistorySnapshot } = useHistorySnapshot()
@ -90,8 +89,8 @@ export default () => {
width: 400, width: 400,
height: 400, height: 400,
rotate: 0, rotate: 0,
themeColor: [themeColor], themeColor: [theme.value.themeColor],
gridColor: fontColor, gridColor: theme.value.fontColor,
data: { data: {
labels: ['类别1', '类别2', '类别3', '类别4', '类别5'], labels: ['类别1', '类别2', '类别3', '类别4', '类别5'],
legends: ['系列1'], legends: ['系列1'],
@ -109,8 +108,8 @@ export default () => {
*/ */
const createTableElement = (row: number, col: number) => { const createTableElement = (row: number, col: number) => {
const style: TableCellStyle = { const style: TableCellStyle = {
fontname: fontName, fontname: theme.value.fontName,
color: fontColor, color: theme.value.fontColor,
} }
const data: TableCell[][] = [] const data: TableCell[][] = []
for (let i = 0; i < row; i++) { for (let i = 0; i < row; i++) {
@ -145,7 +144,7 @@ export default () => {
color: '#eeece1', color: '#eeece1',
}, },
theme: { theme: {
color: themeColor, color: theme.value.themeColor,
rowHeader: true, rowHeader: true,
rowFooter: false, rowFooter: false,
colHeader: false, colHeader: false,
@ -170,8 +169,8 @@ export default () => {
height, height,
content, content,
rotate: 0, rotate: 0,
defaultFontName: fontName, defaultFontName: theme.value.fontName,
defaultColor: fontColor, defaultColor: theme.value.fontColor,
}) })
} }
@ -191,7 +190,7 @@ export default () => {
height, height,
viewBox: data.viewBox, viewBox: data.viewBox,
path: data.path, path: data.path,
fill: themeColor, fill: theme.value.themeColor,
fixedRatio: false, fixedRatio: false,
rotate: 0, rotate: 0,
} }
@ -215,7 +214,7 @@ export default () => {
start, start,
end, end,
points: data.points, points: data.points,
color: themeColor, color: theme.value.themeColor,
style: data.style, style: data.style,
width: 2, width: 2,
} }
@ -239,7 +238,7 @@ export default () => {
top: (VIEWPORT_SIZE * viewportRatio.value - data.h) / 2, top: (VIEWPORT_SIZE * viewportRatio.value - data.h) / 2,
path: data.path, path: data.path,
latex: data.latex, latex: data.latex,
color: fontColor, color: theme.value.fontColor,
strokeWidth: 2, strokeWidth: 2,
viewBox: [data.w, data.h], viewBox: [data.w, data.h],
fixedRatio: true, fixedRatio: true,