Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6924

Creating custom figures

$
0
0

@halley wrote:

Hello,

How can I create custom shapes which consists of other shapes? For eg. we are trying to create the following, however the ellipse border is overlapping the text.
Ellipse in rectangle

Ideally, this is what it should like
indent preformatted text by 4 spaces

function getCustomShapes() {
        go.Shape.defineFigureGenerator("EllipseInRectangle", function (shape, w, h) {
        var geo = new go.Geometry();
              geo.add(new go.PathFigure(0,0)                             
             .add(new go.PathSegment(go.PathSegment.Line, w, 0))
             .add(new go.PathSegment(go.PathSegment.Line, w, h))
             .add(new go.PathSegment(go.PathSegment.Line, 0, h))
             .add(new go.PathSegment(go.PathSegment.Line, 0, 0))                          
         );
        geo.add(new go.PathFigure(0,0)
             .add(new go.PathSegment(go.PathSegment.Arc,0,360,w/2,h/2,w/2,h/2))
             );

        return geo;
       });
    }

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6924

Trending Articles