Commit e72ef995 authored by Jörg Richter's avatar Jörg Richter

Auto-pan on select topic

See dmx-platform/dmx-platform#300
parent 16e065cd
Pipeline #8251 passed with stage
in 3 seconds
......@@ -151,10 +151,37 @@ export default class CytoscapeView {
}).play().promise()
}
playFisheyeAnimation() {
playFisheyeAnimation () {
playFisheyeAnimation()
}
autoPan (node) {
const w = cy.width()
const h = cy.height()
console.log('autoPan', id(node), w, h)
const {x1, y1, x2, y2} = node.renderedBoundingBox()
let x, y
if (x1 < 0) {
console.log('left', -x1)
x = -x1
} else if (x2 > w) {
console.log('right', w - x2)
x = w - x2
}
if (y1 < 0) {
console.log('top', -y1)
y = -y1
} else if (y2 > h) {
console.log('bottom', h - y2)
y = h - y2
}
if (x || y) {
//setTimeout(() => {
cy.panBy({x, y})
//}, 4000)
}
}
/**
* Returns the detail node for the given DMX object.
*
......
......@@ -473,7 +473,11 @@ const actions = {
const p2 = ele && unselectElement()
// Note: the fisheye animation can only be started once the restore animation is complete, *and* "object" is
// available. The actual order of these 2 occasions doesn't matter.
showDetails && Promise.all([p, p2]).then(createAndShowSelectionDetail)
if (showDetails) {
Promise.all([p, p2]).then(createAndShowSelectionDetail)
} else {
cyView.autoPan(_ele)
}
//
ele = _ele
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment