This commit is contained in:
Huy Pham 2019-11-27 13:58:34 -08:00
parent 0f6cca1194
commit 2fc8782360
2 changed files with 5 additions and 4 deletions

View file

@ -366,9 +366,9 @@ class CanvasGraph(tk.Canvas):
self.core.delete_graph_nodes(nodes)
def add_node(self, x, y):
plot_id = self.find_all()[0]
logging.info("add node event: %s - %s", plot_id, self.selected)
if self.selected == plot_id:
canvas_id = self.find_all()[0]
logging.info("add node event: %s - %s", canvas_id, self.selected)
if self.selected == canvas_id:
core_node = self.core.create_node(
int(x), int(y), self.node_draw.node_type, self.node_draw.model
)
@ -651,7 +651,7 @@ class CanvasNode:
self.moving = None
def motion(self, event):
if self.canvas.mode == GraphMode.EDGE or self.canvas.mode == GraphMode.NODE:
if self.canvas.mode == GraphMode.EDGE:
return
x, y = self.canvas.canvas_xy(event)
moving_x, moving_y = self.moving

View file

@ -10,6 +10,7 @@ class Shape:
self.canvas = canvas
self.x0 = topleft_x
self.y0 = topleft_y
# imageenum = self.app.toolbar
self.id = self.canvas.create_oval(
topleft_x, topleft_y, topleft_x + 30, topleft_y + 30
)