* 标准化配置参数,参考 calcQuantity 方法描述。 * 如: * num: 0.5 => 表示 0.5 倍画布宽度 => 标准化为具体数值,如 100 * num: 100 => 表示具体数值 => 标准化结果还是 100
()
| 137 | * num: 100 => 表示具体数值 => 标准化结果还是 100 |
| 138 | */ |
| 139 | private optionsNormalize(): void { |
| 140 | const { canvasWidth, options } = this |
| 141 | const props = ['num', 'proximity', 'range'] as const |
| 142 | |
| 143 | props.forEach((prop: ValueOf<typeof props>) => { |
| 144 | options[prop] = pInt(calcQuantity(options[prop], canvasWidth)) |
| 145 | }) |
| 146 | |
| 147 | // 设置触发事件的元素 |
| 148 | if (!isElement(options.eventElem) && options.eventElem !== document) { |
| 149 | options.eventElem = this.canvas |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * 根据配置参数生成对应形状的连线函数 |
no test coverage detected