ivmartel / dwv

DICOM Web Viewer: open source zero footprint medical image library.
https://ivmartel.github.io/dwv/
GNU General Public License v3.0
1.68k stars 593 forks source link

Draw error when changing layout #1466

Closed ychyss closed 1 year ago

ychyss commented 1 year ago

still using tests/pacs/viewer.js

  1. In single layergroup, I draw some thing in it
  2. change the layout to mpr
  3. try scroll any window, got error (change tool to scroll before I scroll in layergroup doesn't work.)

image

ivmartel commented 1 year ago

This should be fixed in the latest code. Which version are you using?

ychyss commented 1 year ago

I‘m using 0.32.0. Maybe it is because of no deletion of handle of positionchange event on #app in Draw.js. When I change layout, LayerGroup just empty the array of layers this.#layers = [];, without destruction.

ychyss commented 1 year ago

I traced this bug and find that:

I change the name of single layergroup to layerGroupSingle to distinguish with the MPR's layerGroupA, and add some code in #activateCurrentPositionShapes of Draw.js

  #activateCurrentPositionShapes(visible, layerGroup) {
    const drawLayer = layerGroup.getActiveDrawLayer();
    if (!drawLayer) {
      console.log('layerGroup no ActiveDrawLayer: ', layerGroup);
      return;
    }
    const drawController = drawLayer.getDrawController();
    // layerGroup.getActiveDrawLayer().getDrawController();
...

then I got: image

that means the previous event handle still exists.

ivmartel commented 1 year ago

This is the same as #1423, no? It should be fixed in 49d58de. Check out if you get the error in the trunk demo viewer.

There are two available demo viewers, the stable and the trunk one. The stable one will, today, use v0.32.0. The trunk one uses the latest code. The links are:

ychyss commented 1 year ago

image

thanks! I see the info in console.. :-)

I'm sorry to bother you, but I forgot to mention this issue earlier.

And may I ask when version 0.33.0 will be released?

ivmartel commented 1 year ago

This is a warning for when you call getActiveDrawLayer and there is no active draw layer index, possibly because the layer was deleted (for example via a app.removeDataViewConfig).

About the release, I'm still fiddling with the add/remove/update data view config, not clear when this will be finished. I'll say not before 1 or 2 months...

ychyss commented 1 year ago

oh...it sounds like a big work...good luck~

ivmartel commented 1 year ago

Closing for now, feel free to comment if you need.