OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 class GraphView extends View { | 7 class GraphView extends View { |
8 constructor (d3, id, nodes, edges, broker) { | 8 constructor (d3, id, nodes, edges, broker) { |
9 super(id, broker); | 9 super(id, broker); |
10 var graph = this; | 10 var graph = this; |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 graph.viewSelection(); | 503 graph.viewSelection(); |
504 } | 504 } |
505 | 505 |
506 toggleTypesAction(graph) { | 506 toggleTypesAction(graph) { |
507 graph.toggleTypes(); | 507 graph.toggleTypes(); |
508 } | 508 } |
509 | 509 |
510 searchInputAction(graph) { | 510 searchInputAction(graph) { |
511 if (d3.event.keyCode == 13) { | 511 if (d3.event.keyCode == 13) { |
512 graph.state.selection.clear(); | 512 graph.state.selection.clear(); |
513 var reg = new RegExp(this.value); | 513 var query = this.value; |
| 514 window.sessionStorage.setItem("lastSearch", query); |
| 515 |
| 516 var reg = new RegExp(query); |
514 var filterFunction = function(n) { | 517 var filterFunction = function(n) { |
515 return (reg.exec(n.getDisplayLabel()) != null || | 518 return (reg.exec(n.getDisplayLabel()) != null || |
516 (graph.state.showTypes && reg.exec(n.getDisplayType())) || | 519 (graph.state.showTypes && reg.exec(n.getDisplayType())) || |
517 reg.exec(n.opcode) != null); | 520 reg.exec(n.opcode) != null); |
518 }; | 521 }; |
519 if (d3.event.ctrlKey) { | 522 if (d3.event.ctrlKey) { |
520 graph.nodes.forEach(function(n, i) { | 523 graph.nodes.forEach(function(n, i) { |
521 if (filterFunction(n)) { | 524 if (filterFunction(n)) { |
522 n.visible = true; | 525 n.visible = true; |
523 } | 526 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 } | 990 } |
988 | 991 |
989 viewWholeGraph() { | 992 viewWholeGraph() { |
990 var graph = this; | 993 var graph = this; |
991 var minScale = graph.minScale(); | 994 var minScale = graph.minScale(); |
992 var translation = [0, 0]; | 995 var translation = [0, 0]; |
993 translation = graph.getVisibleTranslation(translation, minScale); | 996 translation = graph.getVisibleTranslation(translation, minScale); |
994 graph.translateClipped(translation, minScale); | 997 graph.translateClipped(translation, minScale); |
995 } | 998 } |
996 } | 999 } |
OLD | NEW |