quintel / etmoses

Online decision support tool to create local energy situations for neighbourhoods, cities and regions with a time resolution of 15 minutes created and maintained by Quintel – Not maintained
https://moses.energytransitionmodel.com
MIT License
11 stars 3 forks source link

If the user clicks the node and drags it would be nice to not trigger the drag behaviour if the mousedown target is a node #1498

Closed grdw closed 7 years ago

grdw commented 7 years ago

it would be nice to not trigger the drag behaviour if the mousedown target is a node/popup

It doesn't do this when it's a popup 👍 . It does do it when it's a node 👎 . I'm able to capture the event target when I'm zooming like this:

if (d3.event.sourceEvent.originalTarget.nodeName === "svg") {
   ...
}

This means that I only apply the transition of the svg when my initial mousedown was on the svg. However when I hold my mousedown on the circle and even barely move out of the circle my zoomListener does go into effect resulting in a really stuttery zoom (because I'm moving in and out of the circle).

Another approach would be to remove all zoom listeners from a certain d3 element like this:

d3.select("circle").on(".zoom", null);

However, the zoomListener is attached to the svg and therefor to all the elements inside the svg. So I'm a bit fiddling still but thought I might give you a status update 😄

grdw commented 7 years ago

Ow wait, the answer is already here. 😄