explore.js 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Explore plugin.
  3. */
  4. Draw.loadPlugin(function(ui)
  5. {
  6. // Adds resource for action
  7. mxResources.parse('exploreFromHere=Explore from here...');
  8. var uiCreatePopupMenu = ui.menus.createPopupMenu;
  9. ui.menus.createPopupMenu = function(menu, cell, evt)
  10. {
  11. uiCreatePopupMenu.apply(this, arguments);
  12. var graph = ui.editor.graph;
  13. if (graph.getEdges(graph.getSelectionCell()).length > 0)
  14. {
  15. this.addMenuItems(menu, ['-', 'exploreFromHere'], null, evt);
  16. }
  17. };
  18. // Adds action
  19. ui.actions.addAction('exploreFromHere', function()
  20. {
  21. Graph.exploreFromCell(ui.editor.graph, ui.editor.graph.getSelectionCell());
  22. });
  23. // Click handler for chromeless mode
  24. if (ui.editor.isChromelessView())
  25. {
  26. ui.editor.graph.click = function(me)
  27. {
  28. if (ui.editor.graph.model.isVertex(me.getCell()) &&
  29. ui.editor.graph.model.getEdgeCount(me.getCell()) > 0 &&
  30. this.getLinkForCell(me.getCell()) == null)
  31. {
  32. Graph.exploreFromCell(ui.editor.graph, me.getCell());
  33. }
  34. };
  35. }
  36. });