Adding sigma.js navigation buttons

旧街凉风 提交于 2019-12-03 20:14:43

Figured it out, the code needed to be modified slightly with the new sigma release.

You define a new variable as the camera of the sigma instance, s, and then I used the goTo function for moving the graph (or zooming) as needed. See this github issue on the sigma.js website for more information

var c = s.camera;

// move right example

$(document).ready(function(){
  $(".move-right").bind("click",function(){
      c.goTo({
         x:c.x - 50, y:c.y
      });     
  });
});

// zoom in example

$(document).ready(function(){
  $(".zoom-in").bind("click",function(){
      c.goTo({
          ratio: c.ratio / c.settings('zoomingRatio')
      });
  });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!