fixed right click on topic menu, fixed synapse color when opening for synapse card, removed mCustomScrollbar

This commit is contained in:
Connor Turland 2014-10-04 00:15:47 -04:00
parent fae7f9996d
commit d30417f958
10 changed files with 48 additions and 108 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -424,7 +424,6 @@ Metamaps.GlobalUI.Search = {
padding: '7px 10px 3px 10px',
width: '380px'
});
$('.sidebarSearchField').focus();
self.changing = false;
self.isOpen = true;
});
@ -451,11 +450,6 @@ Metamaps.GlobalUI.Search = {
});
}
}, closeAfter);
/*if (self.locked) {
$('.sidebarSearchField').typeahead('setQuery', '');
$('.sidebarSearchField').blur();
}*/
},
startTypeahead: function () {
var self = Metamaps.GlobalUI.Search;

View file

@ -568,7 +568,12 @@ Metamaps.JIT = {
levelDistance: 200
},
onMouseEnter: function (edge) {
if (edge.getData('alpha') === 0) return; // don't do anything if the edge is filtered
var filtered = edge.getData('alpha') === 0;
// don't do anything if the edge is filtered
// or if the canvas is animating
if (filtered || Metamaps.Visualize.mGraph.busy) return;
$('canvas').css('cursor', 'pointer');
var edgeIsSelected = Metamaps.Selected.Edges.indexOf(edge);
//following if statement only executes if the edge being hovered over is not selected
@ -1089,17 +1094,22 @@ Metamaps.JIT = {
}
//The test synapse was selected!
// make sure the edge hasn't been hidden temporarily
var node1id = synapse.get('edge').nodeFrom.id;
var node2id = synapse.get('edge').nodeTo.id;
var edge = Metamaps.Visualize.mGraph.graph.getAdjacence(node1id, node2id);
if(selectTest){
if(e.ctrlKey){
if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){
Metamaps.Control.deselectEdge(synapse.get('edge'));
}
else{
Metamaps.Control.selectEdge(synapse.get('edge'));
if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
}
}
else{
Metamaps.Control.selectEdge(synapse.get('edge'));
if (edge) Metamaps.Control.selectEdge(synapse.get('edge'));
}
}
});
@ -1227,7 +1237,7 @@ Metamaps.JIT = {
top: e.clientY
});
//add the menu to the page
$('#infovis-canvaswidget').append(rightclickmenu);
$('#wrapper').append(rightclickmenu);
// attach events to clicks on the list items
@ -1259,12 +1269,12 @@ Metamaps.JIT = {
$('.rightclickmenu').remove();
Metamaps.Control.hideSelectedEdges();
Metamaps.Control.hideSelectedNodes();
});
});
// when in radial, center on the topic you picked
$('.rc-center').click(function () {
$('.rightclickmenu').remove();
centerOn(node.id);
Metamaps.Topic.centerOn(node.id);
});
// open the entity in a new tab
@ -1282,7 +1292,7 @@ Metamaps.JIT = {
});
// change the metacode of all the selected nodes that you have edit permission for
$('.rc-metacode li').click(function () {
$('.rc-metacode li li').click(function () {
$('.rightclickmenu').remove();
//
Metamaps.Control.updateSelectedMetacodes($(this).attr('data-id'));

View file

@ -27,7 +27,7 @@ Metamaps.Settings = {
background: '#344A58',
synapses: {
normal: '#888888',
hover: '#222222',
hover: '#888888',
selected: '#FFFFFF'
},
topics: {
@ -61,6 +61,12 @@ Metamaps.Mouse = {
};
Metamaps.Selected = {
reset: function () {
var self = Metamaps.Selected;
self.Nodes = [];
self.edges = [];
},
Nodes: [],
Edges: []
};
@ -1323,6 +1329,7 @@ Metamaps.Visualize = {
self.mGraph.loadJSON(Metamaps.JIT.vizData, rootIndex);
//compute positions and plot.
self.computePositions();
self.mGraph.busy = true;
if (self.type == "RGraph") {
self.mGraph.fx.animate(Metamaps.JIT.RGraph.animate);
} else if (self.type == "ForceDirected") {
@ -1494,7 +1501,7 @@ Metamaps.Realtime = {
});
$('body').click(self.close);
self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com');
self.socket = io.connect('http://localhost:5001');
self.startActiveMap();
},
toggleBox: function (event) {
@ -2222,7 +2229,7 @@ Metamaps.Control = {
}
Metamaps.Visualize.mGraph.plot();
},
deselectEdge: function (edge, quick) {
deselectEdge: function (edge) {
edge.setData('showDesc', false, 'current');
edge.setDataset('current', {
@ -2233,8 +2240,7 @@ Metamaps.Control = {
if (Metamaps.Mouse.edgeHoveringOver == edge) {
edge.setDataset('current', {
showDesc: true,
lineWidth: 4,
color: Metamaps.Settings.colors.synapses.hover
lineWidth: 4
});
}
@ -2295,6 +2301,7 @@ Metamaps.Control = {
var from = edge.nodeFrom.id;
var to = edge.nodeTo.id;
edge.setData('alpha', 0, 'end');
Metamaps.Control.deselectEdge(edge);
Metamaps.Visualize.mGraph.fx.animate({
modes: ['edge-property:alpha'],
duration: 500
@ -2924,6 +2931,9 @@ Metamaps.Topic = {
// update filters
Metamaps.Filter.reset();
// reset selected arrays
Metamaps.Selected.reset();
// these three update the actual filter box with the right list items
Metamaps.Filter.checkMetacodes();
Metamaps.Filter.checkSynapses();
@ -2942,6 +2952,18 @@ Metamaps.Topic = {
Metamaps.SynapseCard.hideCard();
}
},
centerOn: function (nodeid) {
if (!Metamaps.Visualize.mGraph.busy) {
var node = Metamaps.Visualize.mGraph.graph.getNode(nodeid);
Metamaps.Visualize.mGraph.onClick(node.id, {
hideLabels: false,
duration: 1000,
onComplete: function () {
}
});
}
},
/*
*
*
@ -3163,9 +3185,8 @@ Metamaps.Synapse = {
Metamaps.Visualize.mGraph.graph.addAdjacence(node1, node2, newedge.data);
edgeOnViz = Metamaps.Visualize.mGraph.graph.getAdjacence(node1.id, node2.id);
synapse.set('edge', edgeOnViz);
synapse.updateEdge(); // links the topic and the mapping to the node
synapse.updateEdge(); // links the synapse and the mapping to the edge
Metamaps.Visualize.mGraph.fx.plotLine(edgeOnViz, Metamaps.Visualize.mGraph.canvas);
Metamaps.Control.selectEdge(edgeOnViz);
var mappingSuccessCallback = function (mappingModel, response) {
@ -3310,6 +3331,9 @@ Metamaps.Map = {
// update filters
Metamaps.Filter.reset();
// reset selected arrays
Metamaps.Selected.reset();
// set the proper mapinfobox content
Metamaps.Map.InfoBox.load();

View file

@ -31,21 +31,4 @@ function fetchRelatives(node) {
alert('failure');
}
});
}
function centerOn(nodeid) {
if (!Mconsole.busy) {
var node = Mconsole.graph.getNode(nodeid);
$('div.index img').attr('src', imgArray[node.getData('metacode')].src);
$('div.index .mapName').html(node.name);
$(document).attr('title', node.name + ' | Metamaps');
window.history.pushState(node.name, "Metamaps", "/topics/" + node.id);
Mconsole.onClick(node.id, {
hideLabels: false,
duration: 1000,
onComplete: function () {
fetchRelatives(node);
}
});
}
}

View file

@ -108,9 +108,6 @@ class TopicsController < ApplicationController
@map = m.map
@map.touch(:updated_at)
#push notify to anyone viewing same map in realtime (see mapping.rb to understand the 'message' action)
m.message 'destroy',@current.id
m.delete
end
@ -122,9 +119,6 @@ class TopicsController < ApplicationController
@map = mapping.map
@map.touch(:updated_at)
#push notify to anyone viewing a map with this topic in realtime (see mapping.rb to understand the 'message' action)
mapping.message 'destroy',@current.id
mapping.delete
end

View file

@ -17,31 +17,5 @@ class Mapping < ActiveRecord::Base
def as_json(options={})
super(:methods =>[:user_name, :user_image])
end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
if self.category == "Topic"
return if self.topic.permission == "private" and action == "create"
msg = { origin: origin_user_id,
mapid: self.map.id,
resource: self.category,
action: action,
id: self.topic.id,
obj: self.topic.selfonmap_as_json(self.map.id).html_safe }
elsif self.category == "Synapse"
return if self.synapse.permission == "private" and action == "create"
msg = { origin: origin_user_id,
mapid: self.map.id,
resource: self.category,
action: action,
id: self.synapse.id,
obj: self.synapse.self_as_json.html_safe }
end
$redis.publish 'maps', msg.to_json
end
end

View file

@ -20,25 +20,6 @@ class Synapse < ActiveRecord::Base
super(:methods =>[:user_name, :user_image])
end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
return if self.permission == "private" and action == "create"
#get array of all maps topic appears in
@maps = self.maps
#sends update to all maps that topic appears in who have realtime on
@maps.each do |map|
msg = { origin: origin_user_id,
mapid: map.id,
resource: 'Synapse',
action: action,
id: self.id,
obj: self.self_as_json.html_safe }
$redis.publish 'maps', msg.to_json
end
end
##### PERMISSIONS ######
# returns false if user not allowed to 'show' Topic, Synapse, or Map

View file

@ -58,25 +58,6 @@ class Topic < ActiveRecord::Base
super(:methods =>[:user_name, :user_image, :map_count, :synapse_count])
end
# sends push updates through redis to websockets for realtime updates
def message action, origin_user_id
return if self.permission == "private" and action == "create"
#get array of all maps topic appears in
@maps = self.maps
#sends update to all maps that topic appears in who have realtime on
@maps.each do |map|
msg = { origin: origin_user_id,
mapid: map.id,
resource: 'Topic',
action: action,
id: self.id,
obj: self.selfonmap_as_json(map.id).html_safe }
$redis.publish 'maps', msg.to_json
end
end
def topic_autocomplete_method
"Get: #{self.name}"
end