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 'rails3-jquery-autocomplete'
gem 'best_in_place'
gem 'therubyracer' #optional
gem 'rb-readline'
#gem 'therubyracer' #optional
#gem 'rb-readline'
# Gems used only for assets and not required
# in production environments by default.

View file

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

View file

@ -13,7 +13,7 @@ gem 'formtastic'
gem 'json'
gem 'rails3-jquery-autocomplete'
gem 'best_in_place'
#gem 'therubyracer' #optional
gem 'therubyracer' #optional
gem 'rb-readline'
# 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
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;
//topic and synapse editing cards
@ -111,7 +118,7 @@ function graphSettings(type, embed) {
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) {
selectEdgeOnClickHandler(node, e);
} else if (node && !node.nodeFrom) {
@ -432,6 +439,7 @@ var nodeSettings = {
}
function drawSelectBox(eventInfo, e) {
Mconsole.plot();
var ctx=Mconsole.canvas.getCtx();
var startX = MetamapsModel.boxStartCoordinates.x,
@ -475,21 +483,6 @@ function selectNodesWithBox() {
function onMouseMoveHandler(node, eventInfo, e) {
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 edge = eventInfo.getEdge();

View file

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

View file

@ -21,7 +21,7 @@
// other options are 'graph'
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() {

View file

@ -14,4 +14,10 @@
span.name {
cursor: pointer;
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; */
}
#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 --*/
.headertop {
display:block;