(
{
left,
top,
width,
height,
path,
matrix,
id,
currentClipPath,
src,
}: {
left: number
top: number
width: number
height: number
path: string
matrix: string | undefined
id: string
currentClipPath: string | string
src?: string
},
style: Record<string, string | number>,
inheritableStyle: Record<string, string | number>
)
| 7 | import { buildClipPath, genClipPathId } from './clip-path.js' |
| 8 | |
| 9 | export default function overflow( |
| 10 | { |
| 11 | left, |
| 12 | top, |
| 13 | width, |
| 14 | height, |
| 15 | path, |
| 16 | matrix, |
| 17 | id, |
| 18 | currentClipPath, |
| 19 | src, |
| 20 | }: { |
| 21 | left: number |
| 22 | top: number |
| 23 | width: number |
| 24 | height: number |
| 25 | path: string |
| 26 | matrix: string | undefined |
| 27 | id: string |
| 28 | currentClipPath: string | string |
| 29 | src?: string |
| 30 | }, |
| 31 | style: Record<string, string | number>, |
| 32 | inheritableStyle: Record<string, string | number> |
| 33 | ) { |
| 34 | let overflowClipPath = '' |
| 35 | const clipPath = |
| 36 | style.clipPath && style.clipPath !== 'none' |
| 37 | ? buildClipPath( |
| 38 | { left, top, width, height, path, id, matrix, currentClipPath, src }, |
| 39 | style as Record<string, number>, |
| 40 | inheritableStyle |
| 41 | ) |
| 42 | : '' |
| 43 | |
| 44 | if (style.overflow !== 'hidden' && !src) { |
| 45 | overflowClipPath = '' |
| 46 | } else { |
| 47 | const _id = clipPath ? `satori_ocp-${id}` : genClipPathId(id) |
| 48 | |
| 49 | overflowClipPath = buildXMLString( |
| 50 | 'clipPath', |
| 51 | { |
| 52 | id: _id, |
| 53 | 'clip-path': currentClipPath, |
| 54 | }, |
| 55 | buildXMLString(path ? 'path' : 'rect', { |
| 56 | x: left, |
| 57 | y: top, |
| 58 | width, |
| 59 | height, |
| 60 | d: path ? path : undefined, |
| 61 | // add transformation matrix to clip path if overflow is hidden AND a |
| 62 | // transformation style is defined, otherwise children will be clipped |
| 63 | // relative to the parent's original plane instead of the transformed |
| 64 | // plane |
| 65 | transform: |
| 66 | style.overflow === 'hidden' && style.transform && matrix |
no test coverage detected
searching dependent graphs…