44 |
44 |
45 peer.getVerticalScrollBar.setUnitIncrement(10) |
45 peer.getVerticalScrollBar.setUnitIncrement(10) |
46 |
46 |
47 def find_visible_node(at: Point2D): Option[Graph_Display.Node] = |
47 def find_visible_node(at: Point2D): Option[Graph_Display.Node] = |
48 visualizer.visible_graph.keys_iterator.find(node => |
48 visualizer.visible_graph.keys_iterator.find(node => |
49 visualizer.Drawer.shape(node).contains(at)) |
49 Shapes.Node.shape(visualizer, node).contains(at)) |
50 |
50 |
51 def refresh() |
51 def refresh() |
52 { |
52 { |
53 if (paint_panel != null) { |
53 if (paint_panel != null) { |
54 paint_panel.set_preferred_size() |
54 paint_panel.set_preferred_size() |
174 draginfo = (to, p, d) |
174 draginfo = (to, p, d) |
175 case e @ MouseClicked(_, p, m, n, _) => click(p, m, n, e) |
175 case e @ MouseClicked(_, p, m, n, _) => click(p, m, n, e) |
176 } |
176 } |
177 |
177 |
178 def dummy(at: Point2D): Option[(Graph_Display.Edge, Int)] = |
178 def dummy(at: Point2D): Option[(Graph_Display.Edge, Int)] = |
179 { |
|
180 visualizer.visible_graph.edges_iterator.map(edge => |
179 visualizer.visible_graph.edges_iterator.map(edge => |
181 visualizer.Coordinates.get_dummies(edge).zipWithIndex.map((edge, _))).flatten.find( |
180 visualizer.Coordinates.get_dummies(edge).zipWithIndex.map((edge, _))).flatten. |
182 { |
181 collectFirst({ |
183 case (_, (p, _)) => |
182 case (edge, (d, index)) |
184 visualizer.Drawer.shape(Graph_Display.Node.dummy). |
183 if Shapes.Dummy.shape(visualizer, d).contains(at) => (edge, index) |
185 contains(at.getX() - p.x, at.getY() - p.y) |
184 }) |
186 }) match { |
|
187 case None => None |
|
188 case Some((edge, (_, index))) => Some((edge, index)) |
|
189 } |
|
190 } |
|
191 |
185 |
192 def pressed(at: Point) |
186 def pressed(at: Point) |
193 { |
187 { |
194 val c = Transform.pane_to_graph_coordinates(at) |
188 val c = Transform.pane_to_graph_coordinates(at) |
195 val l = |
189 val l = |