Dear Mr.Walter,
Greetings! I have managed to fix the center circle while scrolling vertically and during horizontall I have moved it. I used the following code. If I keep the horizontal scroll bar in center its working fine. if I keep left or right corner and do the vertical scroll, it is getting overlapping as we discues ealier… I used the following code. Pls help me to change only the value of y. or advice me if any.
var oldVpbY = 0;
function recenterRoot(e) {
if(oldVpbY == 0 || isNaN(oldVpbY) || oldVpbY== undefined || oldVpbY== “undefined”){
alert(“inside”);
//oldVpbY = e.subject.bounds.y;
oldVpbY = diagram.viewportBounds.y;
}
console.log(diagram.viewportBounds.y);
console.log(diagram.viewportBounds);
console.log(diagram.viewportBounds.x);
if(oldVpbY != diagram.viewportBounds.y && isNaN(oldVpbY)==false){
//--------------------------recenter------------------------------------------------------------------
cX = diagram.viewportBounds.centerX;
cY = diagram.viewportBounds.centerY;
var root = e.diagram.findNodeForKey(“e1”);
if (root) {
e.diagram.commit(function(diag) {
root.location = new go.Point(cX, cY);
}, null); // don't record in UndoManager
}
var fixedObj2 = e.diagram.findNodeForKey("h1");
if (fixedObj2) {
e.diagram.commit(function(diag1) {
fixedObj2.location = new go.Point(cX, cY-300);
}, null); // don't record in UndoManager
}
//------------------------------------
oldVpbY = diagram.viewportBounds.y;
}
}
Thanks and Regards,
Syed Abdul Rahim