filter and realtime button active states. zoomExtents excludes filtered topics

This commit is contained in:
Connor Turland 2014-11-21 15:45:44 -05:00
parent e9a39f9838
commit 0ebc3dbc37
5 changed files with 82 additions and 19 deletions

View file

@ -1861,7 +1861,7 @@ Metamaps.JIT = {
var x = n.pos.x, var x = n.pos.x,
y = n.pos.y; y = n.pos.y;
if (counter == 0){ if (counter == 0 && n.getData('alpha') == 1){
maxX = x; maxX = x;
minX = x; minX = x;
maxY = y; maxY = y;
@ -1880,12 +1880,15 @@ Metamaps.JIT = {
} }
var width = Math.max.apply(null, lineWidths) + 8; var width = Math.max.apply(null, lineWidths) + 8;
// only adjust these values if the node is not filtered
if (n.getData('alpha') == 1) {
maxX = Math.max(x + width /2,maxX); maxX = Math.max(x + width /2,maxX);
maxY = Math.max(y + n.getData("height") + 5 + height,maxY); maxY = Math.max(y + n.getData("height") + 5 + height,maxY);
minX = Math.min(x - width /2,minX); minX = Math.min(x - width /2,minX);
minY = Math.min(y - dim,minY); minY = Math.min(y - dim,minY);
counter++; counter++;
}
}); });
var spanX = maxX - minX; var spanX = maxX - minX;

View file

@ -1888,13 +1888,13 @@ Metamaps.Realtime = {
turnOn: function (notify) { turnOn: function (notify) {
var self = Metamaps.Realtime; var self = Metamaps.Realtime;
if (!self.status) {
if (notify) self.sendRealtimeOn(); if (notify) self.sendRealtimeOn();
$(".rtMapperSelf").removeClass('littleRtOff').addClass('littleRtOn'); $(".rtMapperSelf").removeClass('littleRtOff').addClass('littleRtOn');
$('.rtOn').addClass('active');
$('.rtOff').removeClass('active');
self.status = true; self.status = true;
$(".sidebarCollaborateIcon").addClass("blue"); $(".sidebarCollaborateIcon").addClass("blue");
$(".collabCompass").show(); $(".collabCompass").show();
}
}, },
turnOff: function (silent) { turnOff: function (silent) {
var self = Metamaps.Realtime; var self = Metamaps.Realtime;
@ -1902,6 +1902,8 @@ Metamaps.Realtime = {
if (self.status) { if (self.status) {
if (!silent) self.sendRealtimeOff(); if (!silent) self.sendRealtimeOff();
$(".rtMapperSelf").removeClass('littleRtOn').addClass('littleRtOff'); $(".rtMapperSelf").removeClass('littleRtOn').addClass('littleRtOff');
$('.rtOn').removeClass('active');
$('.rtOff').addClass('active');
self.status = false; self.status = false;
$(".sidebarCollaborateIcon").removeClass("blue"); $(".sidebarCollaborateIcon").removeClass("blue");
$(".collabCompass").hide(); $(".collabCompass").hide();
@ -3111,6 +3113,8 @@ Metamaps.Filter = {
$('#filter_by_metacode ul').empty(); $('#filter_by_metacode ul').empty();
$('#filter_by_mapper ul').empty(); $('#filter_by_mapper ul').empty();
$('#filter_by_synapse ul').empty(); $('#filter_by_synapse ul').empty();
$('.filterBox .showAll').addClass('active');
}, },
/* /*
Most of this data essentially depends on the ruby function which are happening for filter inside view filterBox Most of this data essentially depends on the ruby function which are happening for filter inside view filterBox
@ -3239,36 +3243,48 @@ Metamaps.Filter = {
filterAllMetacodes: function (e) { filterAllMetacodes: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_metacode ul li').addClass('toggledOff'); $('#filter_by_metacode ul li').addClass('toggledOff');
$('.showAllMetacodes').removeClass('active');
$('.hideAllMetacodes').addClass('active');
self.visible.metacodes = []; self.visible.metacodes = [];
self.passFilters(); self.passFilters();
}, },
filterNoMetacodes: function (e) { filterNoMetacodes: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_metacode ul li').removeClass('toggledOff'); $('#filter_by_metacode ul li').removeClass('toggledOff');
$('.showAllMetacodes').addClass('active');
$('.hideAllMetacodes').removeClass('active');
self.visible.metacodes = self.filters.metacodes.slice(); self.visible.metacodes = self.filters.metacodes.slice();
self.passFilters(); self.passFilters();
}, },
filterAllMappers: function (e) { filterAllMappers: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_mapper ul li').addClass('toggledOff'); $('#filter_by_mapper ul li').addClass('toggledOff');
$('.showAllMappers').removeClass('active');
$('.hideAllMappers').addClass('active');
self.visible.mappers = []; self.visible.mappers = [];
self.passFilters(); self.passFilters();
}, },
filterNoMappers: function (e) { filterNoMappers: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_mapper ul li').removeClass('toggledOff'); $('#filter_by_mapper ul li').removeClass('toggledOff');
$('.showAllMappers').addClass('active');
$('.hideAllMappers').removeClass('active');
self.visible.mappers = self.filters.mappers.slice(); self.visible.mappers = self.filters.mappers.slice();
self.passFilters(); self.passFilters();
}, },
filterAllSynapses: function (e) { filterAllSynapses: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_synapse ul li').addClass('toggledOff'); $('#filter_by_synapse ul li').addClass('toggledOff');
$('.showAllSynapses').removeClass('active');
$('.hideAllSynapses').addClass('active');
self.visible.synapses = []; self.visible.synapses = [];
self.passFilters(); self.passFilters();
}, },
filterNoSynapses: function (e) { filterNoSynapses: function (e) {
var self = Metamaps.Filter; var self = Metamaps.Filter;
$('#filter_by_synapse ul li').removeClass('toggledOff'); $('#filter_by_synapse ul li').removeClass('toggledOff');
$('.showAllSynapses').addClass('active');
$('.hideAllSynapses').removeClass('active');
self.visible.synapses = self.filters.synapses.slice(); self.visible.synapses = self.filters.synapses.slice();
self.passFilters(); self.passFilters();
}, },
@ -3292,14 +3308,53 @@ Metamaps.Filter = {
toggleMetacode: function () { toggleMetacode: function () {
var self = Metamaps.Filter; var self = Metamaps.Filter;
self.toggleLi.call(this, 'metacodes'); self.toggleLi.call(this, 'metacodes');
if (self.visible.metacodes.length === self.filters.metacodes.length) {
$('.showAllMetacodes').addClass('active');
$('.hideAllMetacodes').removeClass('active');
}
else if (self.visible.metacodes.length === 0) {
$('.showAllMetacodes').removeClass('active');
$('.hideAllMetacodes').addClass('active');
}
else {
$('.showAllMetacodes').removeClass('active');
$('.hideAllMetacodes').removeClass('active');
}
}, },
toggleMapper: function () { toggleMapper: function () {
var self = Metamaps.Filter; var self = Metamaps.Filter;
self.toggleLi.call(this, 'mappers'); self.toggleLi.call(this, 'mappers');
if (self.visible.mappers.length === self.filters.mappers.length) {
$('.showAllMappers').addClass('active');
$('.hideAllMappers').removeClass('active');
}
else if (self.visible.mappers.length === 0) {
$('.showAllMappers').removeClass('active');
$('.hideAllMappers').addClass('active');
}
else {
$('.showAllMappers').removeClass('active');
$('.hideAllMappers').removeClass('active');
}
}, },
toggleSynapse: function () { toggleSynapse: function () {
var self = Metamaps.Filter; var self = Metamaps.Filter;
self.toggleLi.call(this, 'synapses'); self.toggleLi.call(this, 'synapses');
if (self.visible.synapses.length === self.filters.synapses.length) {
$('.showAllSynapses').addClass('active');
$('.hideAllSynapses').removeClass('active');
}
else if (self.visible.synapses.length === 0) {
$('.showAllSynapses').removeClass('active');
$('.hideAllSynapses').addClass('active');
}
else {
$('.showAllSynapses').removeClass('active');
$('.hideAllSynapses').removeClass('active');
}
}, },
passFilters: function () { passFilters: function () {
var self = Metamaps.Filter; var self = Metamaps.Filter;
@ -4204,6 +4259,7 @@ Metamaps.Map = {
Metamaps.Create.newTopic.hide(); Metamaps.Create.newTopic.hide();
Metamaps.Create.newSynapse.hide(); Metamaps.Create.newSynapse.hide();
Metamaps.Filter.close(); Metamaps.Filter.close();
Metamaps.Map.InfoBox.close();
Metamaps.Realtime.endActiveMap(); Metamaps.Realtime.endActiveMap();
} }
}, },

View file

@ -1007,7 +1007,7 @@ h3.filterBox {
cursor: pointer; cursor: pointer;
font-size:12px; font-size:12px;
} }
.sidebarFilterBox span:hover { .sidebarFilterBox span:hover, .sidebarFilterBox span.active {
color: #00BCD4; color: #00BCD4;
} }
.sidebarFilterBox ul { .sidebarFilterBox ul {
@ -1104,7 +1104,7 @@ h3.realtimeBoxTitle {
text-align: center; text-align: center;
font-size:12px; font-size:12px;
} }
.sidebarCollaborateBox .realtimeOnOff:hover { .sidebarCollaborateBox .realtimeOnOff:hover, .sidebarCollaborateBox .realtimeOnOff.active {
color: #00bcd4; color: #00bcd4;
} }
.sidebarCollaborateBox .rtOff { .sidebarCollaborateBox .rtOff {

View file

@ -759,6 +759,10 @@
right: 24px; right: 24px;
} }
.topicPage .zoomExtents {
display: none;
}
.mapControl { .mapControl {
width:32px; width:32px;
height:32px; height:32px;

View file

@ -91,7 +91,7 @@
<div id="filter_by_mapper" class="filterBySection"> <div id="filter_by_mapper" class="filterBySection">
<h3><%= @map ? "MAPPERS" : @topic ? "CREATORS" : "" %></h3> <h3><%= @map ? "MAPPERS" : @topic ? "CREATORS" : "" %></h3>
<span class="hideAll hideAllMappers">NONE</span> <span class="hideAll hideAllMappers">NONE</span>
<span class="showAll showAllMappers">ALL</span> <span class="active showAll showAllMappers">ALL</span>
<div class="clearfloat"></div> <div class="clearfloat"></div>
<ul> <ul>
<%= @mapperlist.html_safe %> <%= @mapperlist.html_safe %>
@ -102,7 +102,7 @@
<div id="filter_by_metacode" class="filterBySection"> <div id="filter_by_metacode" class="filterBySection">
<h3>METACODES</h3> <h3>METACODES</h3>
<span class="hideAll hideAllMetacodes">NONE</span> <span class="hideAll hideAllMetacodes">NONE</span>
<span class="showAll showAllMetacodes">ALL</span> <span class="active showAll showAllMetacodes">ALL</span>
<div class="clearfloat"></div> <div class="clearfloat"></div>
<ul> <ul>
<%= @metacodelist.html_safe %> <%= @metacodelist.html_safe %>
@ -113,7 +113,7 @@
<div id="filter_by_synapse" class="filterBySection"> <div id="filter_by_synapse" class="filterBySection">
<h3>SYNAPSES</h3> <h3>SYNAPSES</h3>
<span class="hideAll hideAllSynapses">NONE</span> <span class="hideAll hideAllSynapses">NONE</span>
<span class="showAll showAllSynapses">ALL</span> <span class="active showAll showAllSynapses">ALL</span>
<div class="clearfloat"></div> <div class="clearfloat"></div>
<ul> <ul>
<%= @synapselist.html_safe %> <%= @synapselist.html_safe %>