* 获取形状数据
()
| 145 | * 获取形状数据 |
| 146 | */ |
| 147 | protected getShapeData(): ShapeData { |
| 148 | const { shape } = this.options |
| 149 | const defaultShapeData: ShapeData = { type: 'circle' } |
| 150 | |
| 151 | if (!shape) { |
| 152 | return defaultShapeData |
| 153 | } |
| 154 | |
| 155 | if (isArray(shape)) { |
| 156 | const length = (shape as ShapeType[]).length |
| 157 | if (length) { |
| 158 | const value = (shape as ShapeType[])[Math.floor(Math.random() * length)] |
| 159 | return generateShapeData(value) |
| 160 | } |
| 161 | return defaultShapeData |
| 162 | } |
| 163 | |
| 164 | return generateShapeData(shape as ShapeType) |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * 绘制形状 |
nothing calls this directly
no test coverage detected