Skip to content

Commit d106ac6

Browse files
authored
Add border geometry as Path instead of loop for TextAnnotation frames (#9108)
1 parent a59280d commit d106ac6

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/core-backend",
5+
"comment": "Add outline geometry as Path instead of Loop in text annotations",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/core-backend"
10+
}

core/backend/src/annotations/FrameGeometry.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ export function appendFrameToBuilder(builder: ElementGeometry.Builder, frame: Te
4949

5050
// The tile generator does not produce an outline for shapes with blanking fill. We must add the outline separately.
5151
if (params.fillDisplay === FillDisplay.Blanking) {
52-
const outlineParams = params.clone();
53-
outlineParams.fillDisplay = FillDisplay.Never;
54-
if (!builder.appendGeometryParamsChange(outlineParams) || !builder.appendGeometryQuery(frameGeometry)) {
52+
const path = frameGeometry instanceof Loop ? Path.createArray(frameGeometry.children) : frameGeometry;
53+
if (!builder.appendGeometryQuery(path)) {
5554
return false;
5655
}
5756
}

core/backend/src/test/annotations/FrameGeometry.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { expect } from "chai";
7-
import { CurvePrimitive, Geometry, Point3d, Range2d, Transform, Vector3d } from "@itwin/core-geometry";
7+
import { CurvePrimitive, Geometry, Path, Point3d, Range2d, Transform, Vector3d } from "@itwin/core-geometry";
88
import { ColorDef, GeometryParams, textAnnotationFrameShapes, TextFrameStyleProps } from "@itwin/core-common";
99
import { appendFrameToBuilder, computeFrame } from "../../annotations/FrameGeometry";
1010
import { Id64 } from "@itwin/core-bentley";
@@ -46,6 +46,7 @@ describe("FrameGeometry", () => {
4646
const result = appendFrameToBuilder(builder, frame, defaultRange, defaultTransform, defaultParams);
4747
expect(result).to.be.true;
4848
expect(builder.geometries.length).to.be.equal(2);
49+
expect(builder.geometries[1] instanceof Path).to.be.true; // The second geometry should be the outline geometry, which is a Path
4950
});
5051

5152
it("should set fill and border colors from frame", () => {

0 commit comments

Comments
 (0)