shift+click for box selecting topics

This commit is contained in:
Connor Turland 2013-03-29 02:38:13 -04:00
parent c93c74094c
commit 1491c20895
8 changed files with 49 additions and 28 deletions

View file

@ -13,8 +13,8 @@ gem 'formtastic'
gem 'json' gem 'json'
gem 'rails3-jquery-autocomplete' gem 'rails3-jquery-autocomplete'
gem 'best_in_place' gem 'best_in_place'
gem 'therubyracer' #optional #gem 'therubyracer' #optional
gem 'rb-readline' #gem 'rb-readline'
# Gems used only for assets and not required # Gems used only for assets and not required
# in production environments by default. # in production environments by default.

View file

@ -94,7 +94,6 @@ GEM
rdoc (~> 3.4) rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0) thor (>= 0.14.6, < 2.0)
rake (10.0.3) rake (10.0.3)
rb-readline (0.4.1)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
sass (3.2.1) sass (3.2.1)
@ -134,6 +133,5 @@ DEPENDENCIES
pg pg
rails (= 3.2.11) rails (= 3.2.11)
rails3-jquery-autocomplete rails3-jquery-autocomplete
rb-readline
sass-rails (~> 3.2.3) sass-rails (~> 3.2.3)
uglifier (>= 1.0.3) uglifier (>= 1.0.3)

View file

@ -13,7 +13,7 @@ gem 'formtastic'
gem 'json' gem 'json'
gem 'rails3-jquery-autocomplete' gem 'rails3-jquery-autocomplete'
gem 'best_in_place' gem 'best_in_place'
#gem 'therubyracer' #optional gem 'therubyracer' #optional
gem 'rb-readline' gem 'rb-readline'
# Gems used only for assets and not required # Gems used only for assets and not required

View file

@ -102,6 +102,13 @@ function graphSettings(type, embed) {
}, },
//Add also a click handler to nodes //Add also a click handler to nodes
onClick: function (node, eventInfo, e) { onClick: function (node, eventInfo, e) {
if (MetamapsModel.boxStartCoordinates) {
Mconsole.busy = false;
MetamapsModel.boxEndCoordinates = eventInfo.getPos();
selectNodesWithBox();
return;
}
if (e.target.id != "infovis-canvas") return false; if (e.target.id != "infovis-canvas") return false;
//topic and synapse editing cards //topic and synapse editing cards
@ -111,7 +118,7 @@ function graphSettings(type, embed) {
deselectAllEdges(); deselectAllEdges();
} }
//clicking on a node, or clicking on blank part of canvas? //clicking on a edge, node, or clicking on blank part of canvas?
if (node.nodeFrom) { if (node.nodeFrom) {
selectEdgeOnClickHandler(node, e); selectEdgeOnClickHandler(node, e);
} else if (node && !node.nodeFrom) { } else if (node && !node.nodeFrom) {
@ -432,6 +439,7 @@ var nodeSettings = {
} }
function drawSelectBox(eventInfo, e) { function drawSelectBox(eventInfo, e) {
Mconsole.plot();
var ctx=Mconsole.canvas.getCtx(); var ctx=Mconsole.canvas.getCtx();
var startX = MetamapsModel.boxStartCoordinates.x, var startX = MetamapsModel.boxStartCoordinates.x,
@ -476,21 +484,6 @@ function onMouseMoveHandler(node, eventInfo, e) {
if (Mconsole.busy) return; if (Mconsole.busy) return;
if (!MetamapsModel.boxStartCoordinates && e.shiftKey) {
MetamapsModel.boxStartCoordinates = eventInfo.getPos();
return;
}
if (MetamapsModel.boxStartCoordinates && e.shiftKey) {
drawSelectBox(eventInfo,e);
return;
}
if (MetamapsModel.boxStartCoordinates && !e.shiftKey) {
MetamapsModel.boxEndCoordinates = eventInfo.getPos();
Mconsole.plot();
selectNodesWithBox();
return;
}
var node = eventInfo.getNode(); var node = eventInfo.getNode();
var edge = eventInfo.getEdge(); var edge = eventInfo.getEdge();

View file

@ -2616,6 +2616,11 @@ Extras.Classes.Navigation = new Class({
if(!this.config.panning) return; if(!this.config.panning) return;
if(this.config.panning == 'avoid nodes' && eventInfo.getNode()) return; if(this.config.panning == 'avoid nodes' && eventInfo.getNode()) return;
this.pressed = true; this.pressed = true;
//START METAMAPS CODE
if (!MetamapsModel.boxStartCoordinates && e.shiftKey) {
MetamapsModel.boxStartCoordinates = eventInfo.getPos();
}
// END METAMAPS CODE
this.pos = eventInfo.getPos(); this.pos = eventInfo.getPos();
var canvas = this.canvas, var canvas = this.canvas,
ox = canvas.translateOffsetX, ox = canvas.translateOffsetX,
@ -2632,12 +2637,22 @@ Extras.Classes.Navigation = new Class({
if(!this.config.panning) return; if(!this.config.panning) return;
if(!this.pressed) return; if(!this.pressed) return;
if(this.config.panning == 'avoid nodes' && eventInfo.getNode()) return; if(this.config.panning == 'avoid nodes' && eventInfo.getNode()) return;
// START METAMAPS CODE // START METAMAPS CODE
if (e.target.id != 'infovis-canvas') { if (!MetamapsModel.boxStartCoordinates && e.shiftKey) {
this.pressed = false; Mconsole.busy = true;
return; MetamapsModel.boxStartCoordinates = eventInfo.getPos();
} return;
// END METAMAPS CODE }
if (MetamapsModel.boxStartCoordinates && e.shiftKey) {
Mconsole.busy = true;
drawSelectBox(eventInfo,e);
return;
}
if (e.target.id != 'infovis-canvas') {
this.pressed = false;
return;
}
// END METAMAPS CODE
var thispos = this.pos, var thispos = this.pos,
currentPos = eventInfo.getPos(), currentPos = eventInfo.getPos(),
canvas = this.canvas, canvas = this.canvas,

View file

@ -21,7 +21,7 @@
// other options are 'graph' // other options are 'graph'
var viewMode = "list"; var viewMode = "list";
var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false, mapid = null, mapperm = false, touchPos, touchDragNode; var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false, mapid = null, mapperm = false, touchPos, touchDragNode, mouseIsDown = false;
$(document).ready(function() { $(document).ready(function() {

View file

@ -14,4 +14,10 @@
span.name { span.name {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
} }

View file

@ -245,6 +245,15 @@ input[type="submit"] {
/*overflow:hidden; */ /*overflow:hidden; */
} }
#infovis-canvas {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* --- top options --*/ /* --- top options --*/
.headertop { .headertop {
display:block; display:block;