radius 属性现在支持四角独立圆角对象 { topLeft, topRight, bottomRight, bottomLeft },
每个角可以设置不同的圆角半径。也支持通过 style.radius 或 style.borderRadius 设置。
当设为数字时四角相同(向后兼容)。
// 统一圆角(向后兼容)
g.createShape('rect', { position: {x: 20, y: 20}, width: 200, height: 80, radius: 20,
style: { fill: '#e94560' }
});
// 四角独立圆角
g.createShape('rect', { position: {x: 20, y: 130}, width: 200, height: 80,
radius: { topLeft: 30, topRight: 5, bottomRight: 30, bottomLeft: 5 },
style: { fill: '#00d4ff' }
});
// 通过 style 设置
g.createShape('rect', { position: {x: 20, y: 240}, width: 200, height: 80,
style: { fill: '#00ff88', borderRadius: { topLeft: 40, topRight: 0, bottomRight: 0, bottomLeft: 40 } }
});
// 胶囊形(radius 等于高度一半)
g.createShape('rect', { position: {x: 300, y: 20}, width: 200, height: 60, radius: 30,
style: { fill: '#ffd93d' }
});