From 6840d69747984b88630c1fa2abd3d82674cb70a7 Mon Sep 17 00:00:00 2001 From: Raymon Johnstone Date: Sat, 18 Oct 2014 13:56:45 -0400 Subject: [PATCH 1/4] lightboxes and stylesheet changes --- app/assets/stylesheets/application.css | 8 ++++++++ app/views/layouts/_lightboxes.html.erb | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index c6002195..0d81479d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2676,3 +2676,11 @@ and it won't be important on password protected instances */ -webkit-transform-origin: left center; transform-origin: left center; } +.blockchain-btn { + display: inline; + float: right; +} +script.data-gratipay-username { + display: inline; + float: left; +} \ No newline at end of file diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index 9ace06a0..14c32853 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -167,14 +167,14 @@

We welcome people of all skillsets to contribute to the project in different ways. Designers, researchers, academics, strategists, and facilitators can get in touch about opportunities to contribute to the project. If you're a developer, help us advance the code and take a look around our Github.

Financial contributions are greatly appreciated in support of our work. All financial contributions are transparently governed and recorded in our value accounting system.

- -
+
-
+
From 4db8dd90a202b9383d88ed7b9e3c9761547aa228 Mon Sep 17 00:00:00 2001 From: Raymon Johnstone Date: Sat, 18 Oct 2014 20:28:16 -0400 Subject: [PATCH 2/4] Changed a bunch of mouse functionality mappings. LeftDrag+CTRL+SHIFT to zoom to box (Or rightDrag + CTRL). The rest of left dragging is for selection --- app/assets/javascripts/src/JIT.js | 13 +++- app/assets/javascripts/src/Metamaps.JIT.js | 70 +++++++++++++++------- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/src/JIT.js b/app/assets/javascripts/src/JIT.js index 1cfc48c8..42ff94c7 100644 --- a/app/assets/javascripts/src/JIT.js +++ b/app/assets/javascripts/src/JIT.js @@ -2481,6 +2481,7 @@ Extras.Classes.Navigation = new Class({ }, onMouseDown: function(e, win, eventInfo) { + console.log('mouse down!!!!'); if(!this.config.panning) return; //START METAMAPS CODE @@ -2495,8 +2496,9 @@ Extras.Classes.Navigation = new Class({ //START METAMAPS CODE var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey); // TODO make sure this works across browsers - if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) { + if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos(); + console.log('mouse down'); } Metamaps.Mouse.didPan = false; @@ -2524,14 +2526,19 @@ Extras.Classes.Navigation = new Class({ // START METAMAPS CODE var rightClick = e.button == 2 || (navigator.platform.indexOf("Mac") != -1 && e.ctrlKey); - if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) { + if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Visualize.mGraph.busy = true; Metamaps.boxStartCoordinates = eventInfo.getPos(); + console.log('mouse move'); return; } - if (Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) { + if (Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Visualize.mGraph.busy = true; Metamaps.JIT.drawSelectBox(eventInfo,e); + console.log('mouse move'); + return; + } + if (rightClick){ return; } if (e.target.id != 'infovis-canvas') { diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 95b80fde..13ec7ed8 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -301,13 +301,16 @@ Metamaps.JIT = { enableForEdges: true, onMouseMove: function (node, eventInfo, e) { Metamaps.JIT.onMouseMoveHandler(node, eventInfo, e); + console.log('called mouse move handler'); }, //Update node positions when dragged onDragMove: function (node, eventInfo, e) { Metamaps.JIT.onDragMoveTopicHandler(node, eventInfo, e); + console.log('called drag move handler'); }, onDragEnd: function (node, eventInfo, e) { Metamaps.JIT.onDragEndTopicHandler(node, eventInfo, e, false); + console.log('called drag end handler'); }, onDragCancel: function (node, eventInfo, e) { Metamaps.JIT.onDragCancelHandler(node, eventInfo, e, false); @@ -352,10 +355,20 @@ Metamaps.JIT = { $('.rightclickmenu').remove(); if (Metamaps.Mouse.boxStartCoordinates) { - Metamaps.Visualize.mGraph.busy = false; - Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.zoomToBox(e); - return; + if(e.ctrlKey && e.shiftKey){ + Metamaps.Visualize.mGraph.busy = false; + Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); + Metamaps.JIT.zoomToBox(e); + console.log('called zoom to box'); + return; + } + else if (e.ctrlKey || e.shiftKey) { + Metamaps.Visualize.mGraph.busy = false; + Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); + Metamaps.JIT.selectWithBox(e); + console.log('called select with box'); + return; + }; } if (e.target.id != "infovis-canvas") return false; @@ -363,10 +376,13 @@ Metamaps.JIT = { //clicking on a edge, node, or clicking on blank part of canvas? if (node.nodeFrom) { Metamaps.JIT.selectEdgeOnClickHandler(node, e); + console.log('called selectEdgeOnClickHandler'); } else if (node && !node.nodeFrom) { Metamaps.JIT.selectNodeOnClickHandler(node, e); + console.log('called selectNodeOnClickHandler'); } else { Metamaps.JIT.canvasClickHandler(eventInfo.getPos(), e); + console.log('called canvasClickHandler'); } //if }, //Add also a click handler to nodes @@ -375,10 +391,10 @@ Metamaps.JIT = { // remove the rightclickmenu $('.rightclickmenu').remove(); - if (Metamaps.Mouse.boxStartCoordinates) { + if (Metamaps.Mouse.boxStartCoordinates && e.ctrlKey) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.selectWithBox(e); + Metamaps.JIT.zoomToBox(e); return; } @@ -390,8 +406,8 @@ Metamaps.JIT = { } else if (node && !node.nodeFrom) { Metamaps.JIT.selectNodeOnRightClickHandler(node, e); } else { - console.log('right clicked on open space'); - } //if + //console.log('right clicked on open space'); + } } }, //Number of iterations for the FD algorithm @@ -736,7 +752,7 @@ Metamaps.JIT = { if (node && !node.nodeFrom) { var pos = eventInfo.getPos(); // if it's a left click, or a touch, move the node - if (e.touches || (e.button == 0 && !e.altKey && (e.buttons == 0 || e.buttons == 1 || e.buttons == undefined))) { + if (e.touches || (e.button == 0 && !e.altKey && !e.ctrlKey && !e.shiftKey && (e.buttons == 0 || e.buttons == 1 || e.buttons == undefined))) { //if the node dragged isn't already selected, select it var whatToDo = self.handleSelectionBeforeDragging(node, e); if (node.pos.rho || node.pos.rho === 0) { @@ -949,8 +965,10 @@ Metamaps.JIT = { tempInit = false; tempNode = null; tempNode2 = null; - Metamaps.Control.deselectAllEdges(); - Metamaps.Control.deselectAllNodes(); + if (!e.ctrlKey && !e.shiftKey) { + Metamaps.Control.deselectAllEdges(); + Metamaps.Control.deselectAllNodes(); + } } }, //canvasClickHandler nodeDoubleClickHandler: function (node, e) { @@ -1181,19 +1199,20 @@ Metamaps.JIT = { if (!e.shiftKey && !e.ctrlKey) { Metamaps.Control.deselectAllNodes(); Metamaps.Control.deselectAllEdges(); + Metamaps.Control.selectNode(node,e); } - if(e.ctrlKey || e.shiftKey){ + else if(e.shiftKey && e.ctrlKey){ + //no result + } + else if(e.ctrlKey){ if (node.selected) { Metamaps.Control.deselectNode(node); } else { Metamaps.Control.selectNode(node,e); } - } - else{ - Metamaps.Control.deselectAllNodes(); - Metamaps.Control.deselectAllEdges(); + }else if(e.shiftKey){ Metamaps.Control.selectNode(node,e); - } + } //trigger animation to final styles Metamaps.Visualize.mGraph.fx.animate({ @@ -1352,15 +1371,24 @@ Metamaps.JIT = { // wait a certain length of time, then check again, then run this code setTimeout(function () { if (!Metamaps.JIT.nodeWasDoubleClicked()) { - if (!e.shiftKey) { + if (!e.shiftKey && !e.ctrlKey) { Metamaps.Control.deselectAllNodes(); Metamaps.Control.deselectAllEdges(); } - if (Metamaps.Selected.Edges.indexOf(adj) !== -1) { - Metamaps.Control.deselectEdge(adj); - } else { + else if (e.shiftKey && e.ctrlKey){ + //no result + } + else if (e.ctrlKey){ + if (Metamaps.Selected.Edges.indexOf(adj) !== -1) { + Metamaps.Control.deselectEdge(adj); + } else { + Metamaps.Control.selectEdge(adj); + } + } + else if (e.shiftKey){ Metamaps.Control.selectEdge(adj); } + Metamaps.Visualize.mGraph.plot(); } }, Metamaps.Mouse.DOUBLE_CLICK_TOLERANCE); From ba2888420e1cf8bd63e87e2d0220ab9b2a4fa559 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Wed, 22 Oct 2014 09:39:14 -0400 Subject: [PATCH 3/4] Update Metamaps.JIT.js Commented out the console logs for now. --- app/assets/javascripts/src/Metamaps.JIT.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 13ec7ed8..07a17149 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -301,16 +301,16 @@ Metamaps.JIT = { enableForEdges: true, onMouseMove: function (node, eventInfo, e) { Metamaps.JIT.onMouseMoveHandler(node, eventInfo, e); - console.log('called mouse move handler'); + //console.log('called mouse move handler'); }, //Update node positions when dragged onDragMove: function (node, eventInfo, e) { Metamaps.JIT.onDragMoveTopicHandler(node, eventInfo, e); - console.log('called drag move handler'); + //console.log('called drag move handler'); }, onDragEnd: function (node, eventInfo, e) { Metamaps.JIT.onDragEndTopicHandler(node, eventInfo, e, false); - console.log('called drag end handler'); + //console.log('called drag end handler'); }, onDragCancel: function (node, eventInfo, e) { Metamaps.JIT.onDragCancelHandler(node, eventInfo, e, false); @@ -359,14 +359,14 @@ Metamaps.JIT = { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); Metamaps.JIT.zoomToBox(e); - console.log('called zoom to box'); + //console.log('called zoom to box'); return; } else if (e.ctrlKey || e.shiftKey) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); Metamaps.JIT.selectWithBox(e); - console.log('called select with box'); + //console.log('called select with box'); return; }; } @@ -376,13 +376,13 @@ Metamaps.JIT = { //clicking on a edge, node, or clicking on blank part of canvas? if (node.nodeFrom) { Metamaps.JIT.selectEdgeOnClickHandler(node, e); - console.log('called selectEdgeOnClickHandler'); + //console.log('called selectEdgeOnClickHandler'); } else if (node && !node.nodeFrom) { Metamaps.JIT.selectNodeOnClickHandler(node, e); - console.log('called selectNodeOnClickHandler'); + //console.log('called selectNodeOnClickHandler'); } else { Metamaps.JIT.canvasClickHandler(eventInfo.getPos(), e); - console.log('called canvasClickHandler'); + //console.log('called canvasClickHandler'); } //if }, //Add also a click handler to nodes From 7e6092070a6a48e06f7c2d8b4d66ad4fdb8a6a4f Mon Sep 17 00:00:00 2001 From: Robert Best Date: Wed, 22 Oct 2014 09:41:21 -0400 Subject: [PATCH 4/4] Update JIT.js Commented out the console logs for now. --- app/assets/javascripts/src/JIT.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/src/JIT.js b/app/assets/javascripts/src/JIT.js index 42ff94c7..7483a544 100644 --- a/app/assets/javascripts/src/JIT.js +++ b/app/assets/javascripts/src/JIT.js @@ -2481,7 +2481,7 @@ Extras.Classes.Navigation = new Class({ }, onMouseDown: function(e, win, eventInfo) { - console.log('mouse down!!!!'); + ///console.log('mouse down!!!!'); if(!this.config.panning) return; //START METAMAPS CODE @@ -2498,7 +2498,7 @@ Extras.Classes.Navigation = new Class({ // TODO make sure this works across browsers if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos(); - console.log('mouse down'); + //console.log('mouse down'); } Metamaps.Mouse.didPan = false; @@ -2529,13 +2529,13 @@ Extras.Classes.Navigation = new Class({ if (!Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Visualize.mGraph.busy = true; Metamaps.boxStartCoordinates = eventInfo.getPos(); - console.log('mouse move'); + //console.log('mouse move'); return; } if (Metamaps.Mouse.boxStartCoordinates && ((e.button == 0 && e.shiftKey) || (e.button == 0 && e.ctrlKey) || (rightClick && e.ctrlKey))) { Metamaps.Visualize.mGraph.busy = true; Metamaps.JIT.drawSelectBox(eventInfo,e); - console.log('mouse move'); + //console.log('mouse move'); return; } if (rightClick){ @@ -11209,4 +11209,4 @@ $jit.ForceDirected3D.$extend = true; - })(); \ No newline at end of file + })();