Giter Club home page Giter Club logo

Comments (5)

pantera17 avatar pantera17 commented on May 24, 2024

Before use function zoomTo set value:
sigInst._core.mousecaptor.isMouseDown = !sigInst._core.mousecaptor.isMouseDown;
OR
sigInst._core.mousecaptor.isMouseDown = TRUE;

from sigma.js.

roamato avatar roamato commented on May 24, 2024

Thanks but following your suggestion in a previous post I've already attempted this way and it doesn't work. with this line before the zoomTo the search don't even start (the graph doesn't move at all)...any idea?

from sigma.js.

roamato avatar roamato commented on May 24, 2024

Solved changing draw() with draw(2,2,2). Now the problem is that I cannot search for another node while I'm zoomed on the first one. The graph move to a total different place. Probably there is an issue with coordinates system and how displayX/Y are updated?

from sigma.js.

roamato avatar roamato commented on May 24, 2024

Dirty way to solve is to put a position(0,0,1) before the zoomTo

from sigma.js.

 avatar commented on May 24, 2024

When i search any name on my inputBox then name node comes to the center and Zoom in. I tried according to you , but i can't do. I hope so u give me positive response as soon as possible. i written my code below plz check it & guide me -

function init() {
var sigInst = sigma.init($('#sigma-example')[0]).drawingProperties({
defaultLabelColor: "#ffffff",
defaultLabelSize: 14,
defaultLabelBGColor: "#ffffff",
defaultHoverLabelBGColor: "#ffffff",
defaultLabelHoverColor: "#000000",
labelThreshold: 10,
defaultEdgeType: "curve",
hoverFontStyle: "bold",
fontStyle: "bold",
activeFontStyle: "bold"
})
.graphProperties({
minNodeSize: 1,
maxNodeSize: 7,
minEdgeSize: 0.2,
maxEdgeSize: 0.5
})
.mouseProperties({
minRatio: 0.75, // How far can we zoom out?
maxRatio: 20, // How far can we zoom in?
});

    sigInst.parseJson("js/demo.php",
    function(){
        sigInst.draw(2,2,2);
        //sigInst.position(0,0,1).draw();
    var $mysearch = $('#searchsubtmit');
        var x = document.getElementById("searchResult");
        $mysearch.bind('click',function(){


            var saveInputValue = document.getElementById('searchbox').value;

            var a;

var b = !1;
b = this.exactMatch?("^"+saveInputValue+"$").toLowerCase():saveInputValue.toLowerCase();
// alert(b);

            var node;
                sigInst.iterNodes(function(n){
                node = n;
                //console.log(n.label);
                var c = !1;
    c = this.exactMatch?("^"+n.label+"$").toLowerCase():n.label.toLowerCase();

// alert(b);

//------------------------- This code for zoom in & center

                if(b == c){
                sigInst._core.mousecaptor.isMouseDown = !sigInst._core.mousecaptor.isMouseDown;
                sigma.instances[1].zoomTo(n['displayX'],n['displayY'],5);
                    x.innerHTML = c
                alert(n.label); 


                }

                }
                )
                    }
                    )draw(2,2,2);

-------------------------//
});

Thank u

from sigma.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.