mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 导出PPTX优化(阴影角度)
This commit is contained in:
parent
2b3ce493f0
commit
113a755e3a
@ -255,13 +255,59 @@ export default () => {
|
||||
// 获取阴影配置
|
||||
const getShadowOption = (shadow: PPTElementShadow): pptxgen.ShadowProps => {
|
||||
const c = formatColor(shadow.color)
|
||||
const { h, v } = shadow
|
||||
|
||||
let offset = 4
|
||||
let angle = 45
|
||||
|
||||
if (h === 0 && v === 0) {
|
||||
offset = 4
|
||||
angle = 45
|
||||
}
|
||||
else if (h === 0) {
|
||||
if (v > 0) {
|
||||
offset = v
|
||||
angle = 90
|
||||
}
|
||||
else {
|
||||
offset = -v
|
||||
angle = 270
|
||||
}
|
||||
}
|
||||
else if (v === 0) {
|
||||
if (h > 0) {
|
||||
offset = h
|
||||
angle = 1
|
||||
}
|
||||
else {
|
||||
offset = -h
|
||||
angle = 180
|
||||
}
|
||||
}
|
||||
else if (h > 0 && v > 0) {
|
||||
offset = Math.max(h, v)
|
||||
angle = 45
|
||||
}
|
||||
else if (h > 0 && v < 0) {
|
||||
offset = Math.max(h, -v)
|
||||
angle = 315
|
||||
}
|
||||
else if (h < 0 && v > 0) {
|
||||
offset = Math.max(-h, v)
|
||||
angle = 135
|
||||
}
|
||||
else if (h < 0 && v < 0) {
|
||||
offset = Math.max(-h, -v)
|
||||
angle = 225
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'outer',
|
||||
color: c.color.replace('#', ''),
|
||||
opacity: c.alpha,
|
||||
blur: shadow.blur * 0.75,
|
||||
offset: (shadow.h + shadow.v) / 2 * 0.75,
|
||||
angle: 45,
|
||||
offset,
|
||||
angle,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user