Skip to content

Commit

Permalink
fix remaining event updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ASLeonard committed Feb 22, 2024
1 parent 7888bd2 commit f3225b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions js/createLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function createLegend() {

}//createLegend

function legendHover(d) {
function legendHover(event, d) {

chosenColor = hexLocation[hexKey[d]];

Expand All @@ -63,7 +63,7 @@ function legendHover(d) {

}//legendHover

function legendHoverOut() {
function legendHoverOut(event, d) {

//If the search is active, only bring back those rects from the artist
//Else bring back all rects
Expand Down
24 changes: 12 additions & 12 deletions js/dive_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ d3.json("data/network.json", function(error, graph) {
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended))
.on("mouseover", function(d) {
.on("mouseover", function(event, d) {
div.transition()
.duration(200)
.style("opacity", .9);
div .html("<b>"+d.site+"</b>")
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
div.html("<b>"+d.site+"</b>")
.style("left", (event.pageX) + "px")
.style("top", (event.pageY - 28) + "px");
})
.on("mouseout", function(d) {
.on("mouseout", function(event, d) {
div.transition()
.duration(500)
.style("opacity", 0);
Expand Down Expand Up @@ -108,19 +108,19 @@ d3.json("data/network.json", function(error, graph) {
}
});

function dragstarted(d) {
if (!d3.event.active) simulation.alphaTarget(0.3).restart();
function dragstarted(event, d) {
if (!event.active) simulation.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
}

function dragged(d) {
d.fx = d3.event.x;
d.fy = d3.event.y;
function dragged(event, d) {
d.fx = event.x;
d.fy = event.y;
}

function dragended(d) {
if (!d3.event.active) simulation.alphaTarget(0);
function dragended(event, d) {
if (!event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}
Expand Down

0 comments on commit f3225b7

Please sign in to comment.