seung-00 commented on code in PR #4788:
URL: https://github.com/apache/zeppelin/pull/4788#discussion_r1714118829


##########
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:
   Doesn’t `this` work differently between these functions? In event handlers, 
`this` is expected to refer to the DOM element. As far as I know, arrow 
functions don’t guarantee that `this` will be bound to the DOM element.



-- 
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