Guest User

Untitled

a guest
Jan 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <body>
  2. <img src="image.svg" width="600" height="600" />
  3. <svg width="1500" height="650"/>
  4. </body>
  5.  
  6. function example(event, bounding) {
  7. // TODO: review this hack
  8. var magicYOffset = 600;
  9.  
  10. var y = event[1];
  11. var top = bounding.top - magicYOffset;
  12. var bottom = bounding.bottom - magicYOffset;
  13.  
  14. // TODO: do something with the new top and bottom
  15. return ???;
  16. }
  17.  
  18. d3.drag()
  19. .on('start', function (d) {
  20. var event = d3.touch(this) || d3.mouse(this);
  21. clickX = event[0];
  22. clickY = event[1];
  23. cursorX = event[0];
  24. cursorY = event[1];
  25.  
  26. var boundingRect = this.getBoundingClientRect();
  27.  
  28. var flag = example(event, boundingRect);
  29. ...
Add Comment
Please, Sign In to add comment