cytoscape / cytoscape.js-qtip

A Cytoscape.js extension that wraps the QTip jQuery library
MIT License
42 stars 35 forks source link

qtip positions don't update on viewport #8

Closed jenicar closed 9 years ago

jenicar commented 9 years ago

When options.hide.cyViewport is false the qtips are still visible on panning/zooming but their positions don't update

maxkfranz commented 9 years ago

I think you have the condition reversed. It should be true if you want the behaviour and false if not.

jenicar commented 9 years ago

Mm my code below keeps the tooltips when panning or zooming but doesn't update the position. I tried it with one of the examples listed and had the same result (below). If I select the node again the tooltip will readjust but it doesn't work automatically.

If i set cyViewport to be true they disappear.

cy.nodes().filter('[format = "station"]').qtip({
    content: "Hi",
    position: {
        my: 'top center',
        at: 'bottom center'
    },
    style: {
        classes: 'qtip-bootstrap',
        tip: {
            width: 16,
            height: 8
        }
    },
    show: {
        ready: true // Show the tooltip when ready
    },
    hide: {
        event: 'null',
        cyViewport: false
    }

})
image
maxkfranz commented 9 years ago

There are two separate options:

options.position.adjust.cyViewport : When true, updates element qTip position on zoom and pan. Note you'll need your own mechanism to hide out-of-bounds qTips, such as customising the parent container.

options.hide.cyViewport : When true, hides qTips when the viewport is manipulated (i.e. zoom/pan).

Have you set them both?

jenicar commented 9 years ago

I had not. options.position.adjust.cyViewport solved it! thank you so much!