コード例 #1
0
    def __init__(self,
                 config: Configurator,
                 position: Vector,
                 size: Vector,
                 color: List = None,
                 border_color: List = None,
                 border_weight: float = None):

        super().__init__()

        # overwrite none values with defaults
        if color is None:
            color = config.get("ui_settings", "nav_block_background_color")
        if border_color is None:
            border_color = config.get("ui_settings", "nav_block_border_color")
        if border_weight is None:
            border_weight = config.get("ui_settings",
                                       "nav_block_border_weight")

        # set block position/size
        self.position = position  # only modify with set_position
        self.size = size  # only modify with set_size
        self.area = Extent.from_vectors(position, position + size,
                                        False)  # only modify with set_area
        self.is_ellipse = False

        # set block color
        self.color = (color[0], color[1], color[2])
        self.show_background_color = True

        self.border_thickness: float = border_weight
        self.border_color = (border_color[0], border_color[1], border_color[2])
        self.show_border = True
コード例 #2
0
 def get_global_area(self) -> Extent:
     pos = self.get_global_pos()
     return Extent.from_vectors(pos, pos + self.size)