-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Viewport's never-drawn elements overriding display style's exclud…
…ed elements (backport #6988) [release/4.7.x] (#6989) Co-authored-by: Paul Connelly <[email protected]>
- Loading branch information
1 parent
c6399d1
commit dbf12ac
Showing
3 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@itwin/core-frontend/pmc-never-drawn-overwrite_2024-07-18-17-56.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@itwin/core-frontend", | ||
"comment": "Fix Viewport's never-drawn elements overriding the display style's excluded elements.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@itwin/core-frontend" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { expect } from "chai"; | ||
import { testBlankViewport } from "./openBlankViewport"; | ||
import { FeatureSymbology, IModelApp, Viewport, ViewState } from "../core-frontend"; | ||
import { EmptyLocalization } from "@itwin/core-common"; | ||
|
||
describe("FeatureSymbology.Overrides", () => { | ||
before(async () => IModelApp.startup({ localization: new EmptyLocalization() })); | ||
after(async () => IModelApp.shutdown()); | ||
|
||
it("combines viewport's never-drawn elements with display style's excluded elements", () => { | ||
function expectNeverDrawn(view: Viewport | ViewState, ids: string[]): void { | ||
const ovrs = new FeatureSymbology.Overrides(view); | ||
expect(ovrs.neverDrawn.size).to.equal(ids.length); | ||
for (const id of ids) { | ||
expect(ovrs.neverDrawn.hasId(id)).to.be.true; | ||
} | ||
} | ||
|
||
testBlankViewport((vp) => { | ||
expectNeverDrawn(vp.view, []); | ||
expectNeverDrawn(vp, []); | ||
|
||
vp.view.displayStyle.settings.addExcludedElements("0x1"); | ||
expectNeverDrawn(vp.view, ["0x1"]); | ||
expectNeverDrawn(vp, ["0x1"]); | ||
|
||
vp.setNeverDrawn(new Set(["0x2"])); | ||
expectNeverDrawn(vp.view, ["0x1"]); | ||
expectNeverDrawn(vp, ["0x1", "0x2"]); | ||
|
||
vp.view.displayStyle.settings.dropExcludedElement("0x1"); | ||
expectNeverDrawn(vp.view, []); | ||
expectNeverDrawn(vp, ["0x2"]); | ||
|
||
vp.clearNeverDrawn(); | ||
expectNeverDrawn(vp.view, []); | ||
expectNeverDrawn(vp, []); | ||
}); | ||
}); | ||
}); |