tbonelee commented on code in PR #4788:
URL: https://github.com/apache/zeppelin/pull/4788#discussion_r1715210056


##########
zeppelin-web/src/app/visualization/builtins/visualization-d3network.js:
##########
@@ -166,20 +166,20 @@ export default class NetworkVisualization extends 
Visualization {
 
     const drag = d3.behavior.drag()
       .origin((d) => d)
-      .on('dragstart', function(d) {
+      .on('dragstart', (d) => {
         console.log('dragstart');
         d3.event.sourceEvent.stopPropagation();
         d3.select(this).classed('dragging', true);
         self.force.stop();
       })
-      .on('drag', function(d) {
+      .on('drag', (d) => {
         console.log('drag');
         d.px += d3.event.dx;
         d.py += d3.event.dy;
         d.x += d3.event.dx;
         d.y += d3.event.dy;
       })
-      .on('dragend', function(d) {
+      .on('dragend', (d) => {
         console.log('dragend');
         d.fixed = true;
         d3.select(this).classed('dragging', false);

Review Comment:
   I think if we need to change it to an arrow function, we should use 
`d3.event.sourceEvent.target` instead of `this`.
   I haven't tested it personally, but I referred to [the D3 Library V3 
documentation](https://github.com/d3/d3-3.x-api-reference/blob/master/Selections.md#d3_event).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to