SIR,
When nodes are selected and wanted to zoom to that selection is easier
if provided this to zoom to selection for nodes as well
regards
sriram
pkg_sriram said:For instance... if i select the text , it zooms to selection. similarly it selects the nodes to zoom to selection, similarly if i select segement (like shen i select the segment using shape tool, where a small dot is displaed that segment is selected)
Selected text: yes, I think I could do that.
Selected segment: I don't know of a way to do that.
If I knew of a way to find out (through the API) if a segment is selected in that way, then I could do it. Perhaps someone knows how, and will share that information.
Ronny Axelsson said:With one single shortcut or button we can 1.) zoom to selected objects, or 2.) zoom to selected nodes, or 3.) if nothing is selected then zoom to all objects
here you are (:
Sub Zoom2FitSelected()Dim x#, y#, w#, h#, u%, bSelectShape As Boolean bSelectShape = False If Not ActiveShape Is Nothing Then If ActiveSelectionRange.Count > 1 Then bSelectShape = True Else With ActiveShape If .Type <> cdrCurveShape Then bSelectShape = True Else If .Curve.Selection.Count > 1 Then u = ActiveDocument.Unit: ActiveDocument.Unit = cdrMillimeter .Curve.Selection.GetBoundingBox x, y, w, h ActiveWindow.ActiveView.ToFitArea x - 2, y - 2, x + w + 2, y + h + 2 ActiveDocument.Unit = u Else bSelectShape = True End If End If End With End If If bSelectShape Then ActiveWindow.ActiveView.ToFitSelection Else ActiveWindow.ActiveView.ToFitAllObjects End IfEnd Sub
I found an error in the way I was figuring the "padding" for some sizes of selection.
I've fixed that in the code I first posted, and also in the .GMS file for the more recent version.
"Zoom to Selection Plus" - which includes some of the suggestions made by Ronny Axelsson and pkg_sriram - is looking very good at this point!
Eskimo said: "Zoom to Selection Plus" - which includes some of the suggestions made by Ronny Axelsson and pkg_sriram - is looking very good at this point!
I started a new thread in the 2018 forum: Macro: Zoom to Selection Plus.