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

Unable to use the Draw tool #1731

Closed
naccib opened this issue Aug 18, 2024 · 2 comments
Closed

Unable to use the Draw tool #1731

naccib opened this issue Aug 18, 2024 · 2 comments
Labels
question Further information is requested
Milestone

Comments

@naccib
Copy link

naccib commented Aug 18, 2024

Environment

I am using React 18 with TypeScript. DWV is instantiated like so:

// One time setup
    useEffect(() => {
        if(app) {
            return;
        }

        if(seriesCollection.length === 0) {
            console.log('No series found');
            return;
        }

        console.log('Setting up viewer...');

        const newApp = new App();
        const viewConfig = new ViewConfig(ROOT_ID);

        const opts = new AppOptions({'*': [viewConfig] });

        opts.tools = {
            Scroll: new ToolConfig(),
            ZoomAndPan: new ToolConfig(),
            Draw: new ToolConfig(['Rectangle', 'Ruler', 'Ellipse', 'Arrow', 'Circle'])	
        };

        newApp.init(opts);

        const series = seriesCollection[0];

        newApp.loadFiles(series.files);

        newApp.addEventListener('load', () => {
            console.log('Finished loading DICOM files.');

            setImagesLoadingComplete(true);
            
            newApp.setTool('Scroll');
        });

        setApp(newApp);
    }, [app, seriesCollection]);

Bug description

DWV errors on click with the Draw tool selected (using any shape). First, it errors with:

this[#Ki][this[#Vr]] is not a constructor
TypeError: this[#Ki][this[#Vr]] is not a constructor
    at #Kr (draw.js:275:1)
    at #_r (draw.js:258:1)
    at #jr (draw.js:236:1)
    at mousedown (draw.js:382:1)
    at Array.n (toolboxController.js:241:1)
    at He.fireEvent (listen.js:70:1)
    at #Re (drawLayer.js:659:1)


Then, after each second or so, it errors with:

Cannot read properties of null (reading 'getX')
TypeError: Cannot read properties of null (reading 'getX')
    at #$r (draw.js:325:1)
    at mousemove (draw.js:397:1)
    at Array.n (toolboxController.js:241:1)
    at He.fireEvent (listen.js:70:1)
    at #Re (drawLayer.js:659:1)
@ivmartel ivmartel added the question Further information is requested label Aug 19, 2024
@ivmartel ivmartel added this to the 0.34.0 milestone Aug 19, 2024
@ivmartel
Copy link
Owner

How do you activate the draw tool? Check https://github.com/ivmartel/dwv-react for a react integration example.

@ivmartel
Copy link
Owner

I hope the link helped and that you could solve your issue. Closing for now, feel free to comment if you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants