cornerstone3D icon indicating copy to clipboard operation
cornerstone3D copied to clipboard

Crosshair tool not working when using multiple viewports

Open yonvaida opened this issue 3 years ago • 0 comments

If i have multiple viewports even if i have multiple render engines and if i move cross on first view everything work ok. When i click on second view cross is not moving. I think i found a problem in AnnotationRenderingEngine.ts.

 private _renderFlaggedViewports = () => {
    this._throwIfDestroyed();

    const elements = Array.from(this._viewportElements.values());

    for (let i = 0; i < elements.length; i++) {
      const element = elements[i];
      if (this._needsRender.has(element)) {
        this._triggerRender(element);

        // This viewport has been rendered, we can remove it from the set
        this._needsRender.delete(element);

        // If there is nothing left that is flagged for rendering, stop here
        // and allow RAF to be called again
        if (this._needsRender.size === 0) {
          this._animationFrameSet = false;
          this._animationFrameHandle = null;
          return;
        }
      }
    }
  };

In this method if element that need to be rendered is not in viewportElements this element is not deleted from needRender array and this._animationFrameSet will never be false. Is my mistake or i found a bug? Thank you

yonvaida avatar Aug 23 '22 07:08 yonvaida