fix: 支持导出缺少填充属性的形状(#323)

This commit is contained in:
zxc 2025-03-14 12:51:16 +08:00
parent be5af25aa5
commit bccb23c559
4 changed files with 8 additions and 3 deletions

View File

@ -81,6 +81,11 @@ export default () => {
// 格式化颜色值为 透明度 + HexString供pptxgenjs使用 // 格式化颜色值为 透明度 + HexString供pptxgenjs使用
const formatColor = (_color: string) => { const formatColor = (_color: string) => {
if (!_color) return {
alpha: 0,
color: '#000000',
}
const c = tinycolor(_color) const c = tinycolor(_color)
const alpha = c.getAlpha() const alpha = c.getAlpha()
const color = alpha === 0 ? '#ffffff' : c.setAlpha(1).toHexString() const color = alpha === 0 ? '#ffffff' : c.setAlpha(1).toHexString()

View File

@ -319,7 +319,7 @@ export default () => {
top: el.top, top: el.top,
viewBox: [200, 200], viewBox: [200, 200],
path: 'M 0 0 L 200 0 L 200 200 L 0 200 Z', path: 'M 0 0 L 200 0 L 200 200 L 0 200 Z',
fill: fill || 'none', fill,
gradient, gradient,
fixedRatio: false, fixedRatio: false,
rotate: el.rotate, rotate: el.rotate,

View File

@ -43,7 +43,7 @@
stroke-linecap="butt" stroke-linecap="butt"
stroke-miterlimit="8" stroke-miterlimit="8"
:d="elementInfo.path" :d="elementInfo.path"
:fill="elementInfo.gradient ? `url(#base-gradient-${elementInfo.id})` : elementInfo.fill" :fill="elementInfo.gradient ? `url(#base-gradient-${elementInfo.id})` : (elementInfo.fill || 'none')"
:stroke="outlineColor" :stroke="outlineColor"
:stroke-width="outlineWidth" :stroke-width="outlineWidth"
:stroke-dasharray="strokeDashArray" :stroke-dasharray="strokeDashArray"

View File

@ -53,7 +53,7 @@
stroke-linecap="butt" stroke-linecap="butt"
stroke-miterlimit="8" stroke-miterlimit="8"
:d="elementInfo.path" :d="elementInfo.path"
:fill="elementInfo.gradient ? `url(#editabel-gradient-${elementInfo.id})` : elementInfo.fill" :fill="elementInfo.gradient ? `url(#editabel-gradient-${elementInfo.id})` : (elementInfo.fill || 'none')"
:stroke="outlineColor" :stroke="outlineColor"
:stroke-width="outlineWidth" :stroke-width="outlineWidth"
:stroke-dasharray="strokeDashArray" :stroke-dasharray="strokeDashArray"