Shape defineFigureGenerator out of bounds

Hello,
In the previous version of GoJs (2.X), I was able to draw a Shape which is out of the bounds. it was done on purpose because I have some parts of the shape which are designed as a decoration. In the current version of GoJs (We are currently using the 3.0.19 with Angular), I’m not able to do this anymore and I get the following error: ERROR Error: Geometry made with figure “NewDesignOnDemandCyclic” has bounds Rect(0,0,256,162) that are too large for the given size (256,146).
I understand why it’s restricted but is there a way to by pass this restriction ?
My current shape:

go.Shape.defineFigureGenerator('NewDesignOnDemandCyclic', (shape, w, h) => {
		const x1 = 10;
		const x2 = 27;
		const y = 16;

		const param1 = !!shape?.parameter1 ? shape.parameter1 : 5;
		const param2 = !!shape?.parameter2 ? shape.parameter2 : 15;
		const cpOffset1 = param1 * KAPPA;
		const cpOffset2 = param2 * KAPPA;

		return new go.Geometry().add(
			new go.PathFigure(param1, 0, true)
				.add(new go.PathSegment(go.SegmentType.Line, w - param2, 0))
				.add(new go.PathSegment(go.SegmentType.Bezier, w, param2, w - cpOffset2, 0, w, cpOffset2))
				.add(new go.PathSegment(go.SegmentType.Line, w, h - param2))
				.add(new go.PathSegment(go.SegmentType.Bezier, w - param2, h, w, h - cpOffset2, w - cpOffset2, h))
				.add(new go.PathSegment(go.SegmentType.Line, x2, h))
				.add(new go.PathSegment(go.SegmentType.Line, x1, y + h))
				.add(new go.PathSegment(go.SegmentType.Line, x1, h))
				.add(new go.PathSegment(go.SegmentType.Line, param1, h))
				.add(new go.PathSegment(go.SegmentType.Bezier, 0, h - param1, cpOffset1, h, 0, h - cpOffset1))
				.add(new go.PathSegment(go.SegmentType.Line, 0, param1))
				.add(new go.PathSegment(go.SegmentType.Bezier, param1, 0, 0, cpOffset1, cpOffset1, 0).close()),
		);
	});

Yes, that restriction was enforced in a more recent version to avoid a bunch of problems that would typically arise.

Can you have that decoration be a separate Shape? You could position it using a “Spot” Panel surrounding the panel using the original Shape/Geometry.

I was thinking about that too. But it means that I need to add some shape to hide what I don’t want to display. This is what I have:


As you can see, the little triangle part in the bottom of the main shape must be out of the main bound. I could reduce the height by the height of the triangle, but I will lose some content space.
From that apart, thank you for your response. We will try something else for our case

That reminds me of this custom figure used by a tooltip: Fancy ToolTip

1 Like