added color difference to named nodes + fixed node name readability
This commit is contained in:
parent
b3366e5cfe
commit
f04a014478
@ -345,7 +345,8 @@ class Editor:
|
||||
def render_nodes(self) -> None:
|
||||
for node in self.graph.nodes:
|
||||
blitpos = self.world_to_screen(node.x, node.z)
|
||||
pygame.draw.circle(self.win, (255, 0, 0), (blitpos[0], blitpos[1]), self.node_radius)
|
||||
color = (255, 0, 0) if node.name == "" else (255, 0, 255)
|
||||
pygame.draw.circle(self.win, color, (blitpos[0], blitpos[1]), self.node_radius)
|
||||
for node_index in self.selected_nodes:
|
||||
node = self.graph.nodes[node_index]
|
||||
blitpos = self.world_to_screen(node.x, node.z)
|
||||
@ -354,9 +355,12 @@ class Editor:
|
||||
def render_hover_node(self, node_index):
|
||||
if node_index != -1:
|
||||
node = self.graph.nodes[node_index]
|
||||
txt = self.loading_font.render(node.name, True, (0, 0, 0))
|
||||
txt = self.loading_font.render(node.name, True, (255, 255, 255))
|
||||
node_pos = self.world_to_screen(node.x, node.z)
|
||||
self.win.blit(txt, [node_pos[0] - txt.get_width(), node_pos[1] - txt.get_height()])
|
||||
xpos = node_pos[0] - txt.get_width() - self.node_radius * (2 ** -0.5)
|
||||
ypos = node_pos[1] - txt.get_height() - self.node_radius * (2 ** -0.5)
|
||||
pygame.draw.rect(self.win, (0, 0, 0), pygame.Rect(xpos, ypos, txt.get_width(), txt.get_height()))
|
||||
self.win.blit(txt, [xpos, ypos])
|
||||
pygame.draw.circle(self.win, (0, 0, 0), (node_pos[0], node_pos[1]), self.node_radius, self.line_size)
|
||||
|
||||
def render_hover_edge(self, edge_index):
|
||||
|
@ -18,9 +18,9 @@ class Graph:
|
||||
|
||||
TYPE_COLORS: list[tuple[int, int, int]] = [
|
||||
(255, 0, 0),
|
||||
(127, 0, 0),
|
||||
(255, 0, 255),
|
||||
(0, 255, 0),
|
||||
(0, 127, 0),
|
||||
(255, 255, ),
|
||||
(0, 0, 255)
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user