Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

19 lines
711 B
JavaScript

import { getSolidFill } from './fill'
import { RATIO_EMUs_Points } from './constants'
export function getShadow(node, warpObj) {
const chdwClrNode = getSolidFill(node, undefined, undefined, warpObj)
const outerShdwAttrs = node['attrs']
const dir = outerShdwAttrs['dir'] ? (parseInt(outerShdwAttrs['dir']) / 60000) : 0
const dist = outerShdwAttrs['dist'] ? parseInt(outerShdwAttrs['dist']) * RATIO_EMUs_Points : 0
const blurRad = outerShdwAttrs['blurRad'] ? parseInt(outerShdwAttrs['blurRad']) * RATIO_EMUs_Points : ''
const vx = dist * Math.sin(dir * Math.PI / 180)
const hx = dist * Math.cos(dir * Math.PI / 180)
return {
h: hx,
v: vx,
blur: blurRad,
color: chdwClrNode,
}
}