mirror of
https://github.com/weewx/weewx.git
synced 2026-04-25 03:57:05 -04:00
Merge branch 'development' into V5
This commit is contained in:
@@ -425,14 +425,20 @@ class ScaledDraw(object):
|
||||
|
||||
def rectangle(self, box, **options):
|
||||
"""Draw a scaled rectangle.
|
||||
|
||||
box: A pair of 2-way tuples, containing coordinates of opposing corners
|
||||
of the box.
|
||||
|
||||
|
||||
box: A pair of 2-way tuples for the lower-left, then upper-right corners of
|
||||
the box [(llx, lly), (urx, ury)]
|
||||
|
||||
options: passed on to draw.rectangle. Usually contains 'fill' (the color)
|
||||
"""
|
||||
box_scaled = [(coord[0] * self.xscale + self.xoffset + 0.5,
|
||||
coord[1] * self.yscale + self.yoffset + 0.5) for coord in box]
|
||||
# Unpack the box
|
||||
(llsx, llsy), (ursx, ursy) = box
|
||||
|
||||
ulix = int(llsx * self.xscale + self.xoffset + 0.5)
|
||||
uliy = int(ursy * self.yscale + self.yoffset + 0.5)
|
||||
lrix = int(ursx * self.xscale + self.xoffset + 0.5)
|
||||
lriy = int(llsy * self.yscale + self.yoffset + 0.5)
|
||||
box_scaled = ((ulix, uliy), (lrix, lriy))
|
||||
self.draw.rectangle(box_scaled, **options)
|
||||
|
||||
def vector(self, x, vec, vector_rotate, **options):
|
||||
|
||||
Reference in New Issue
Block a user