MCPcopy Create free account
hub / github.com/PageBot/PageBot / drawElementOrigin

Method drawElementOrigin

Lib/pagebot/elements/views/mapview.py:536–559  ·  view source on GitHub ↗
(self, e, origin)

Source from the content-addressed store, hash-verified

534 e._restoreScale(self)
535
536 def drawElementOrigin(self, e, origin):
537 if not (self.showOrigin or e.showOrigin):
538 return
539
540 px, py, _ = pointOffset(e.origin, origin)
541
542 S = e.css('viewInfoOriginMarkerSize', pt(5))
543 # Draw origin of the element.
544 fill = e.css('viewInfoOriginMarkerFill', noColor)
545 stroke = e.css('viewInfoOriginMarkerStroke', blackColor)
546 width = e.css('viewInfoOriginMarkerStrokeWidth', pt(0.25))
547 # Transparent fill, so we can see the marker on dark backgrounds.
548 self.context.fill(fill)
549 self.context.stroke(stroke, width)
550 self.context.oval(px-S, py-S, 2*S, 2*S)
551 self.context.line((px-S, py), (px+S, py))
552 self.context.line((px, py-S), (px, py+S))
553
554 if (self.showDimensions and e.isPage) or e.showDimensions:
555 bs = self.context.newString(e.xy, style=dict(font=self.css('viewInfoFont'),
556 fontSize=self.css('viewInfoFontSize'), leading=self.css('viewInfoLeading'),
557 textFill=color(0.1)))
558 w, h = bs.textSize
559 self.context.text(bs, (px - w/2, py + S*1.5))
560
561 def drawMissingElementRect(self, e, origin):
562 """When designing templates and pages, this will draw a filled

Callers 5

drawPageMetaInfoMethod · 0.95
drawElementInfoMethod · 0.95
drawMetaMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45

Calls 10

pointOffsetFunction · 0.90
ptFunction · 0.90
colorFunction · 0.90
newStringMethod · 0.80
cssMethod · 0.45
fillMethod · 0.45
strokeMethod · 0.45
ovalMethod · 0.45
lineMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected