Quantcast
Viewing all articles
Browse latest Browse all 7417

Centering textblocks in panels

@EvilProfesseur wrote:

I'm trying to show some additional information on nodes, the count and type of children in subtree to be precise. It works more or less okay:

Image may be NSFW.
Clik here to view.

The problem is the textblocks are not properly centered on shapes, and since they have fixed positions they wont work with double-digit numbers. I'm using Panel.position to set it up (of all panel types, this gave me the closest aproximation of what I want). Is there any way to center it properly? The code for current version is this:

$$(go.Panel, go.Panel.Position,
  $$(go.Shape, "circle",
    { position: new go.Point(0, 0),
      fill: "#e7422d",
      width: 20, height: 20,
      strokeWidth: 2,
      stroke: "white"}
    ),
  $$(go.TextBlock, "3", { stroke: "white", position: new go.Point(7, 4) }),
  $$(go.Shape, "circle",
    { position: new go.Point(0, 23),
      fill: "#1d89cf",
      width: 20, height: 20,
      strokeWidth: 2,
      stroke: "white"}
    ),
  $$(go.TextBlock, "9", { stroke: "white", position: new go.Point(7, 27) })
)
);

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7417

Trending Articles