From 7fdc1600ba33fe7fcc65e24e44d837eeb1a1d5f1 Mon Sep 17 00:00:00 2001 From: sanj Date: Fri, 5 Nov 2010 02:58:01 +0530 Subject: [PATCH] kindve ugly fixes to get overlays to work right --- vurbanism/static/js/vurbanism.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/vurbanism/static/js/vurbanism.js b/vurbanism/static/js/vurbanism.js index b6462b4..82b3661 100644 --- a/vurbanism/static/js/vurbanism.js +++ b/vurbanism/static/js/vurbanism.js @@ -93,7 +93,7 @@ function onFeatureSelect(f) { 'height': height + "px", 'display': 'none' } - $('
').addClass('highlightOverlay').css(overlayCss).appendTo('body').fadeTo(100, 0.5).click(function() { + $('
').addClass('highlightOverlay').css(overlayCss).appendTo('body').css({"opacity": "0.4", "display": "block"}).click(function() { $img.click(); }); // currentlySelectedFeature = f; @@ -254,14 +254,40 @@ $('.flyoverImage').live("mouseover", function() { } mapControl.select(flyover); $(this).data("flyover", flyover); -// currentlySelectedFeature = flyover; + $(this).addClass("currentlySelectedImage"); + currentlySelectedFeature = flyover; }); $('.flyoverImage').live("mouseout", function() { + +//FIXME: my eyes peel in misery.. - done because texts dont have overlays. maybe the correct fix here is to edit the js to give texts some sort of overlay instead of hard-coding to $img nonsense. + if (!($('.highlightOverlay').length > 0 && $('.highlightOverlay').is(':visible'))) { + currentlySelectedFeature = false; + } + // console.log(currentlySelectedFeature); - mapControl.unselect($(this).data("flyover")); + var flyover = $(this).data("flyover"); + console.log("mouseout", flyover); +//FIXME: this relies on some very subtle bullshit. + if (flyover == currentlySelectedFeature) { +// console.log("falsey"); + return false; + } + mapControl.unselect($(this).data("flyover")); + $(this).removeClass("currentlySelectedImage"); }); +//FIXME: this is not even a fixme, this is just the end of the sanity of this code. But, the highlights on the thumbnails alongwith selects on map should now work. woohoo. +//hmm so this whole thing behaves a bit strange. + +$('.highlightOverlay').live("mouseout", function() { + currentlySelectedFeature = false; + $('.currentlySelectedImage').mouseout(); +// $('.currentlySelectedImage').removeClass("currentlySelectedImage"); +}); + + + $('#submitQuestions').live("click", function() { $(this).attr("disabled", "disabled"); $(this).text("Thanks!");