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

zoomTouchPinch problems after switching images #109

Closed
leonardorame opened this issue Sep 1, 2015 · 7 comments
Closed

zoomTouchPinch problems after switching images #109

leonardorame opened this issue Sep 1, 2015 · 7 comments

Comments

@leonardorame
Copy link
Contributor

After trying for hours to make this work I post this here because maybe its a bug.

I have only one element to display images with the zoomTouchPinch tool attached. There are two images to be loaded there, one with cornerstoneWebImageLoader, the other with cornerstoneWADOImageLoader.

When I load the first image (it doesn't matter the order, it can be Web or WADO), it works as expected (expand fingers zoom in, contract fingers zoom out), then I switch (*) the image and zoomTouchPinch goes crazy allways zoomming out. It looks like this tool is not "reseted" properly before attaching to the new image.

*: The switching process follows these steps inside loadAndCacheImage:

// the next two lines refreshes the element. I don't know if there's a better way
cornerstone.disable(element);
cornerstone.enable(element);
cornerstone.displayImage(element, image);
cornerstoneTools.touchInput.enable(element);
cornerstoneTools.zoomTouchPinch.activate(element);

I've tried zoomTouchPinch.disable(element) before activate, but it doesn't fix the issue.

@swederik
Copy link
Member

swederik commented Sep 1, 2015

Hmm yeah definitely sounds like a bug. Strange because pinch input handling is quite simple.. I'll look into it. You shouldn't need to disable and re-enable the element just to switch images.

@leonardorame
Copy link
Contributor Author

Hi Erik!, great to know this can be a bug, hopefully you can help me find a workaround/fix.

I know disabling/enabling the element shouldn't be needed, but before switching the images I have to hide the element's canvas with display:none, then, when set display:inline-block again the only way I found to display the element is disable/enable. Do you know a way to clear the canvas without display:none?.

@swederik
Copy link
Member

swederik commented Sep 1, 2015

What about using visibility or opacity in CSS instead of display?

@leonardorame
Copy link
Contributor Author

Thanks that allowed me to remove disable/enable. I had to add cornerstone.resize(element, true) after displayImage because if not, the image was displayed very tiny,

BTW, this doesn't solve the zoomTouchPinch tool problem.

@swederik
Copy link
Member

swederik commented Sep 1, 2015

I can't seem to reproduce this bug. My code is here:

https://gist.github.com/swederik/8a416ad61dea2fcf9deb

Could you tell me if there anything you're doing that I'm not or vice versa?

@leonardorame
Copy link
Contributor Author

Thanks to your example I found the problem, I was calling cornerstoneTools.touchInput.enable(element) inside loadAndCacheImage and you call it just after cornerstone.enable only once.

Fixed!.

@swederik
Copy link
Member

swederik commented Sep 1, 2015

Great! We actually had this same issue before for mouseInput (See #89), so now I've gone and made the same type of change for touch input so this type of bug doesn't occur anymore.

Thanks for the report.

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

No branches or pull requests

2 participants