Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified element graphics are sometimes clipped #7211

Open
pmconne opened this issue Sep 30, 2024 · 0 comments
Open

Modified element graphics are sometimes clipped #7211

pmconne opened this issue Sep 30, 2024 · 0 comments
Labels
bug Something isn't working display needs triage

Comments

@pmconne
Copy link
Member

pmconne commented Sep 30, 2024

Describe the bug
The temporary graphics drawn during a GraphicalEditingScope to represent modified elements are sometimes partially clipped.
Filed on behalf of @bbastings.

To Reproduce
Steps to reproduce the behavior:

Replace MoveElementTool in itwinjs-core\test-apps\display-test-app\src\frontend\EditingTools.ts with this (just so you don’t need to register another tool):

export class MoveElementTool extends Tool {
  public static override toolId = "MoveElement";
 
  public override async run(): Promise<boolean> {
    if (!IModelApp.viewManager.selectedView)
      return false;
 
    const imodel = IModelApp.viewManager.selectedView.iModel;
    if (!imodel.isBriefcaseConnection())
      return false;
 
    await startCommand(imodel);
 
    const id = "0x68b";
    const info = await basicManipulationIpc.requestElementGeometry(id);
    if (undefined === info)
      return false;
 
    const it = new ElementGeometry.Iterator(info);
    it.requestWorldCoordinates();
    let curveData;
 
    for (const entry of it) {
      curveData = { geom: entry.toGeometryQuery() as CurveChain, params: entry.geomParams };
      break;
    }
 
    if (undefined === curveData?.geom)
      return false;
 
    const result = CurveChainWithDistanceIndex.createCapture(curveData.geom).clonePartialCurve(0.9325068888021624, 1.0);
    if (undefined === result)
      return false;
 
    const props = await imodel.elements.loadProps(id) as GeometricElementProps;
    if (undefined === props.placement)
      return false;
 
    const builder = new ElementGeometry.Builder();
    builder.setLocalToWorldFromPlacement(props.placement);
 
    if (!builder.appendGeometryParamsChange(curveData.params))
      return false;
 
    if (!builder.appendGeometryQuery(Path.createArray(result.path.children)))
      return false;
 
    const dataEntry = { format: "flatbuffer", data: builder.entries };
    props.elementGeometryBuilderParams = { entryArray: dataEntry.data };
 
    await basicManipulationIpc.updateGeometricElement(props);
    await imodel.saveChanges();
    return true;
  }
}

Open the attached .bim file for editing in display-test-app and recall the attached saved view.
Key in dta edit then dta move element.

Expected behavior

image

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the applicable information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]
  • iTwin.js Version [e.g. 2.5.3]

Additional context
Add any other context about the problem here.

NoScaleBRep_EditTest_Copy4.zip

@pmconne pmconne added bug Something isn't working display needs triage labels Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working display needs triage
Projects
None yet
Development

No branches or pull requests

1 participant