GoWeb, GoView RescaleWithCenter (3.0.1.2)

It appears that when I add an object to a GoView Selection, RescaleWith Center does not center the selected object.

Here is the code which resides in a class that inherits from GoViewDataRenderer:
public override void HandleClientRequest(string evtargs, System.Collections.Hashtable parameters) { //base.HandleClientRequest(evtargs, parameters); string action = Convert.ToString(parameters["action"]); string nodeid = Convert.ToString(parameters["nodeid"]); string level = Convert.ToString(parameters["zlevel"]); GoObject obj = null; if (nodeid != string.Empty) { obj = this.View.Document.FindPart(Convert.ToInt32(nodeid)) as GoObject; this.View.Selection.Clear(); this.View.Selection.Add(obj); } //convert from relative to absolute if (action != string.Empty) { if (action == "center") { float scale = this.View.DocScale; if (_fitallscale < 1.0f && level != string.Empty) { scale = Convert.ToSingle(level) * _slope + 1.0f; } if (obj != null) { this.View.RescaleWithCenter(scale, obj.Position); } else //if the user just zoomed with no object selected { this.View.DocScale = scale; } } } }

If I delete the line of code where I add the object to the selection, the graph is centered on that node properly. Uncommenting the line causes the graph to center. I attempted to move the selection code after the rescalewithcenter, but the behavior is identical. I am calling this code using goRequest(control,requeststring).

Thanks,
Phil

To clarify. When the user clicks on a node, I want that node to be centered on the canvas. When the user changes the zoom level with a node selected, I want the image to rescale with the first selected object in the center. GoZoom doesn’t work for this situation because there doesn’t appear to be any way to tell it to zoom around a specific point.

When I create the graph, I add the final node to the selection, and would like to center the graph around that object.

Are you able to scroll by hand that selected node to be the center of the view? If not, then that is why your code doesn’t succeed either.

Basically this is a policy that is implemented by GoView.LimitDocPosition, which is similar to the restriction for a Word or WordPad or InternetExplorer user not to be able to scroll the first or the last line of a document to be in the center of the window.

But if you change GoView.SheetStyle to some non-None value, LimitDocPosition does not restrict how GoView.DocPosition can be set.

Yes. I am able to scroll manually to the center. I have solved the problem by using the onselectionadded event. Thanks for your assistance.