You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@htrace.apache.org by iw...@apache.org on 2015/07/13 01:11:28 UTC
incubator-htrace git commit: HTRACE-206. htrace-web: when the canvas
has focus, the delete key should clear,
z key should zoom (Colin Patrick McCabe via iwasakims)
Repository: incubator-htrace
Updated Branches:
refs/heads/master a0f64a3a0 -> 423d5936b
HTRACE-206. htrace-web: when the canvas has focus, the delete key should clear, z key should zoom (Colin Patrick McCabe via iwasakims)
Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/423d5936
Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/423d5936
Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/423d5936
Branch: refs/heads/master
Commit: 423d5936bad97da72d891ffeb756bdee3908f282
Parents: a0f64a3
Author: Masatake Iwasaki <iw...@apache.org>
Authored: Mon Jul 13 08:10:49 2015 +0900
Committer: Masatake Iwasaki <iw...@apache.org>
Committed: Mon Jul 13 08:10:49 2015 +0900
----------------------------------------------------------------------
.../src/main/web/app/search_results_view.js | 22 +++++++++++++++++++-
htrace-webapp/src/main/web/app/search_view.js | 2 +-
htrace-webapp/src/main/web/index.html | 3 ++-
3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/423d5936/htrace-webapp/src/main/web/app/search_results_view.js
----------------------------------------------------------------------
diff --git a/htrace-webapp/src/main/web/app/search_results_view.js b/htrace-webapp/src/main/web/app/search_results_view.js
index 0a11eaa..318b78d 100644
--- a/htrace-webapp/src/main/web/app/search_results_view.js
+++ b/htrace-webapp/src/main/web/app/search_results_view.js
@@ -271,6 +271,7 @@ htrace.SearchResultsView = Backbone.View.extend({
var view = this;
$("#resultsCanvas").off("mousedown");
$("#resultsCanvas").on("mousedown", function(e) {
+ $("#resultsCanvas").focus();
view.handleMouseDown(e);
});
$("#resultsCanvas").off("mouseup");
@@ -289,6 +290,21 @@ htrace.SearchResultsView = Backbone.View.extend({
$("#resultsCanvas").on("dblclick", function(e) {
view.handleDblclick(e);
});
+ // Keyboard events. These events only fire if the canvas has focus. So if
+ // you press delete when entering a time in the time dialog box, this will
+ // not fire. Etc.
+ $("#resultsCanvas").off("keyup");
+ $("#resultsCanvas").on("keyup", function(e) {
+ if (e.keyCode == 46) { // delete key
+ view.clearHandler(false);
+ return false;
+ } else if (e.keyCode == 90) { // z key
+ view.zoomHandler();
+ return false;
+ } else {
+ return true;
+ }
+ });
$("#resultsCanvas").off("contextmenu");
$("#resultsCanvas").on("contextmenu", function(e) {
return false;
@@ -302,6 +318,7 @@ htrace.SearchResultsView = Backbone.View.extend({
$("#resultsCanvas").off("mouseout");
$("#resultsCanvas").off("mousemove");
$("#resultsCanvas").off("dblclick");
+ $("#resultsCanvas").off("keyup");
$("#resultsCanvas").off("contextmenu");
Backbone.View.prototype.remove.apply(this, arguments);
},
@@ -353,7 +370,7 @@ htrace.SearchResultsView = Backbone.View.extend({
// caller should invoke render()
},
- clearHandler: function() {
+ clearHandler: function(clearAllIfNoneSelected) {
console.log("invoking clearHandler.");
var toDelete = []
var noneSelected = true;
@@ -386,6 +403,9 @@ htrace.SearchResultsView = Backbone.View.extend({
toDelete.push(model);
}
}
+ if (noneSelected && (!clearAllIfNoneSelected)) {
+ return;
+ }
ids = [];
for (var i = 0; i < toDelete.length; i++) {
ids.push(toDelete[i].get("spanId"));
http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/423d5936/htrace-webapp/src/main/web/app/search_view.js
----------------------------------------------------------------------
diff --git a/htrace-webapp/src/main/web/app/search_view.js b/htrace-webapp/src/main/web/app/search_view.js
index ffdba4c..aeb4273 100644
--- a/htrace-webapp/src/main/web/app/search_view.js
+++ b/htrace-webapp/src/main/web/app/search_view.js
@@ -48,7 +48,7 @@ htrace.SearchView = Backbone.View.extend({
clearHandler: function(e){
e.preventDefault();
- this.resultsView.clearHandler();
+ this.resultsView.clearHandler(true);
},
doSearch: function(showDebug){
http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/423d5936/htrace-webapp/src/main/web/index.html
----------------------------------------------------------------------
diff --git a/htrace-webapp/src/main/web/index.html b/htrace-webapp/src/main/web/index.html
index fccbded..29a899b 100644
--- a/htrace-webapp/src/main/web/index.html
+++ b/htrace-webapp/src/main/web/index.html
@@ -158,7 +158,8 @@
</script>
<script id="search-results-view-template" type="text/template">
- <canvas id="resultsCanvas" class="htrace-canvas">
+ <!-- tabindex=1 is needed or else the canvas can never gain mouse focus on Chrome. -->
+ <canvas id="resultsCanvas" class="htrace-canvas" tabindex="1">
<h2>Sorry, your browser does not support the HTML5 canvas element. Please
upgrade to a newer browser.</h2>
</canvas>