Custom Badge Shape Border

Hi,

I have been working with custom badge shape that I was able to get from a previous forum post. Here’s the post, I used the code snippet in the very last comment.

https://forum.nwoods.com/t/making-badge-from-roundedrectangle/6743/8

I have one minor issue related to setting the border properly which I don’t think the original poster cared about. I’ve tried to edit the code snippet but am unsure how to achieve what I want. Here’s how it currently looks:

Here’s the code snippet for reference:

go.Shape.defineFigureGenerator('Badge', function(shape, w, h) {
        var radius = h / 2,
            geo = new go.Geometry();

        // a single figure consisting of straight lines and half-circle arcs
        geo.add(new go.PathFigure(0, radius)
            .add(new go.PathSegment(go.PathSegment.Arc, 90, 180, radius, radius, radius, radius))
            .add(new go.PathSegment(go.PathSegment.Line, w - radius, 0))
            .add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w - radius, radius, radius, radius))
            .add(new go.PathSegment(go.PathSegment.Line, radius, h).close()));

        // don't intersect with two top corners when used in an "Auto" Panel
        geo.spot1 = new go.Spot(0, 0, 0.1 * radius, 0.1 * radius);
        geo.spot2 = new go.Spot(1, 1, -0.1 * radius, 0);

        return geo;
    });

It looks like you probably want to use the “Capsule” figure generator, which is defined in extensions/RoundedRectangles.js.

Thank you, that worked perfectly for me. I just had to adjust the extension a little, there was a hard coded parameter that I needed to be different.