If rootStyle.showFlowConnections is True, draw the flow connections on the page, using their stroke / width settings of the style. Only works for nested elements
(self, e, origin)
| 496 | # D R A W I N G F L O W S |
| 497 | |
| 498 | def drawFlowConnections(self, e, origin): |
| 499 | """If rootStyle.showFlowConnections is True, draw the flow connections |
| 500 | on the page, using their stroke / width settings of the style. Only |
| 501 | works for nested elements""" |
| 502 | context = self.context |
| 503 | p = pointOffset(e.origin, origin) |
| 504 | p = e._applyScale(self, p) |
| 505 | |
| 506 | # Ignore z-axis for now. |
| 507 | px, py, _ = p = e._applyAlignment(p) |
| 508 | |
| 509 | if (self.showFlowConnections and e.isPage) or e.showFlowConnections: |
| 510 | #self.css('viewFlowCurvatureFactor', 0.15) |
| 511 | fmf = 0.15 |
| 512 | |
| 513 | for startE in e.elements: |
| 514 | nextE = startE.next |
| 515 | print('drawFlow', nextE) |
| 516 | |
| 517 | if nextE is not None: |
| 518 | # For all the flow sequences found in the page, draw flow |
| 519 | # arrows at offset (ox, oy). |
| 520 | sx = startE.right |
| 521 | sy = startE.bottom |
| 522 | nx = nextE.left |
| 523 | ny = nextE.top |
| 524 | |
| 525 | xm = (nx + sx)/2 |
| 526 | ym = (ny + sy)/2 |
| 527 | xb1 = xm * upt(ny - sy) * fmf |
| 528 | yb1 = ym * upt(nx - sx) * fmf |
| 529 | xb2 = xm * upt(ny - sy) * fmf |
| 530 | yb2 = ym * upt(nx - sx) * fmf |
| 531 | |
| 532 | context.fill(noColor) |
| 533 | context.stroke(color(0), 1) |
| 534 | |
| 535 | context.newPath() |
| 536 | context.moveTo((sx, sy)) |
| 537 | #print('moveto', sx, sy) |
| 538 | context.curveTo((xb1, yb1), (xb2, yb2), (nx, ny)) |
| 539 | #((ax1+ax2)/2, (ay1+ay2)/2)) # End in middle of arrow head. |
| 540 | context.drawPath() |
| 541 | |
| 542 | def drawArrow(self, e, xs, ys, xt, yt, onText=1, startMarker=False, |
| 543 | endMarker=False, fms=None, fmf=None, fill=noColor, stroke=noColor, |
no test coverage detected