Regarding Ports on a shape


Author
Message
Pramod Sreekanthan
Pramod Sreekanthan
Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)
Group: Forum Members
Posts: 17, Visits: 1

Hi,

Actually iam increasing the width of a shape having ports.

When the width increases, the ports are not fixed and move along with the shape's width

I want the location of the ports to be same and according to the diagram co-ordiantes.

They should not change according to the diagram co-ordinates.

 

Thanks

Pramod


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Pramod,

Different port types use different strategies to determine their location in document scene coordinates.

The NRotatedBoundsPort for example computes its location by first generating a point defined in percents of the anchor model - model bounds and transforming this point to scene coordinates using the anchor model SceneTransform. The following code snippet is the implementation of the NRotatedBoundsPort GetLocation method override:

///
/// Overiden to obtain an aligned point relative to the anchor model rotated bounds
/// and apply the current offset to it.
///

///
protected override NPointF GetLocation()
{
if (Shape != null && Shape.IsCollapsed())
return Shape.GetRootCollapsedShape().GetCollapsedPortLocation(this);

NModel model = GetAnchorModel(AnchorUniqueId);
if (model == null)
return NPointF.Empty;

NPointF point = Alignment.GetAlignPoint(model.ModelBounds);
point = model.SceneTransform.TransformPoint(point);

point.X += Offset.Width;
point.Y += Offset.Height;

return point;
}

So naturally when the anchor model model bounds have changed, the location of the port also changes, because it is defined relatively to the anchor model bounds.
In general any custom port location can be achieved by creating a custom port. What is the behavior that you want to achieve?




Best Regards,
Nevron Support Team


Pramod Sreekanthan
Pramod Sreekanthan
Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)
Group: Forum Members
Posts: 17, Visits: 1

Hi,
I have an issue. When i try to increase the width of a shape on the diagram. the ports location also change.
I want the ports to remain static and not move with the shape width.

Thanks,

Pramod


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search