(
min: number,
max: number,
layout1: {brkId: string} | NullUndefined,
layout2: {brkId: string} | NullUndefined
)
| 369 | } |
| 370 | |
| 371 | function addSeg( |
| 372 | min: number, |
| 373 | max: number, |
| 374 | layout1: {brkId: string} | NullUndefined, |
| 375 | layout2: {brkId: string} | NullUndefined |
| 376 | ): void { |
| 377 | |
| 378 | function trans(p1: number[], p2: number[]): void { |
| 379 | if (transform) { |
| 380 | applyTransform(p1, p1, transform); |
| 381 | applyTransform(p2, p2, transform); |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | function subPixelOptimizePP(p1: number[], p2: number[]): void { |
| 386 | const shape = {x1: p1[0], y1: p1[1], x2: p2[0], y2: p2[1]}; |
| 387 | subPixelOptimizeLine(shape, shape, pathBaseProp.style); |
| 388 | p1[0] = shape.x1; |
| 389 | p1[1] = shape.y1; |
| 390 | p2[0] = shape.x2; |
| 391 | p2[1] = shape.y2; |
| 392 | } |
| 393 | const lineP1 = [min, 0]; |
| 394 | const lineP2 = [max, 0]; |
| 395 | |
| 396 | // dummy tick is used to align the line segment ends with axis ticks |
| 397 | // after `subPixelOptimizeLine` being applied. |
| 398 | const dummyTickEnd1 = [min, 5]; |
| 399 | const dummyTickEnd2 = [max, 5]; |
| 400 | trans(lineP1, dummyTickEnd1); |
| 401 | subPixelOptimizePP(lineP1, dummyTickEnd1); |
| 402 | trans(lineP2, dummyTickEnd2); |
| 403 | subPixelOptimizePP(lineP2, dummyTickEnd2); |
| 404 | // Apply it keeping the same as the normal axis line. |
| 405 | subPixelOptimizePP(lineP1, lineP2); |
| 406 | |
| 407 | const seg = new Line(extend({shape: { |
| 408 | x1: lineP1[0], |
| 409 | y1: lineP1[1], |
| 410 | x2: lineP2[0], |
| 411 | y2: lineP2[1], |
| 412 | }}, pathBaseProp)); |
| 413 | |
| 414 | group.add(seg); |
| 415 | // Animation should be precise to be consistent with tick and split line animation. |
| 416 | seg.anid = `breakLine_${layout1 ? layout1.brkId : '\0'}_\0_${layout2 ? layout2.brkId : '\0'}`; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | /** |
no test coverage detected
searching dependent graphs…