Skip to content

No way to alter GeomGraph radX and radY effectively #91

@wolfmcnally

Description

@wolfmcnally

GeomGraph has public attributes radX and radY which contain the corner radius of the graph's bounding rectangle, used when determining the boundaryCurve for the graph.

  • radX and radY in GeomGraph are assigned 10 in the constructor. The constructor then immediately uses these values to construct rrect: RRect.
  • boundaryCurve cannot be altered directly: the setter throws an exception.
  • It can be altered by assigning boundingBox, but in this case it copies the corner radii from the existing RRect, which have previously been assigned 10.
  • So changing radX and radY after constructing the graph does not affect subsequence alterations of boundingBox: they continue to use the values embedded in the boundingBox RRect.

This leaves no apparent API for altering the corner radii.

Expected behavior:

  • changing radX or radY after constructing a GeomGraph and then assigning boundingBox should create a boundaryCurve with the new radii.
  • or a more sophisticated API for either constructing GeomGraph with configurable corner radii
  • or assigning radX and radY invalidates the existing boundaryShape
  • or allow a direct assignment of rrect.

My current workaround uses the last method (which breaks encapsulation):

function setCornerRadius(graph: GeomGraph, radius: number) {
    const bounds = graph.boundingBox;
    const rrect = new RRect({left: bounds.left, top: bounds.top, right: bounds.right, bottom: bounds.bottom, radX: radius, radY: radius});
    (graph as any).rrect = rrect;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions