(
model: Model<{ borderRadius?: string | number | (string | number)[] }>,
shape: Pick<Sector['shape'], 'r0' | 'r'>,
zeroIfNull?: boolean
)
| 23 | import { parsePercent } from 'zrender/src/contain/text'; |
| 24 | |
| 25 | export function getSectorCornerRadius( |
| 26 | model: Model<{ borderRadius?: string | number | (string | number)[] }>, |
| 27 | shape: Pick<Sector['shape'], 'r0' | 'r'>, |
| 28 | zeroIfNull?: boolean |
| 29 | ) { |
| 30 | let cornerRadius = model.get('borderRadius'); |
| 31 | if (cornerRadius == null) { |
| 32 | return zeroIfNull ? { cornerRadius: 0 } : null; |
| 33 | } |
| 34 | if (!isArray(cornerRadius)) { |
| 35 | cornerRadius = [cornerRadius, cornerRadius, cornerRadius, cornerRadius]; |
| 36 | } |
| 37 | const dr = Math.abs(shape.r || 0 - shape.r0 || 0); |
| 38 | return { |
| 39 | cornerRadius: map(cornerRadius, cr => parsePercent(cr, dr)) |
| 40 | }; |
| 41 | } |
no test coverage detected
searching dependent graphs…