-
Notifications
You must be signed in to change notification settings - Fork 452
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
Add configuration and functional option to scroll a stack without skipping images #311
Add configuration and functional option to scroll a stack without skipping images #311
Conversation
Thanks for the contribution! I'll try to get to this ASAP, but it will likely be after the holidays. |
src/stackTools/stackScroll.js
Outdated
|
||
if (config && config.loop) { | ||
loop = config.loop; | ||
} | ||
|
||
scroll(eventData.element, images, loop); | ||
if (config && config.allowSkipping !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to merge this check and default with the above check. For example:
Previous:
if (config && config.loop) {
loop = config.loop;
}
Becomes:
if (config) {
loop = config.loop !== undefined ? config.loop : false;
allowSkipping = config.allowSkipping !== undefined ? config.allowSkipping : true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do.
return; | ||
} | ||
|
||
element.addEventListener('cornerstonenewimage', function(event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing it. Is this the right event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is, as this seems to be the event that is triggered when the index actually changes.
Trying to make sure I understand. In your new implementation, you bypass the
Where we:
I think this would force
Then they should all display in order without skipping. Note: I've also added some comments to your code with additional questions. Follow-up question for @swederik, does |
Correct. As far as I can tell scrollToIndex just queues the image call, which may or may not execute in order depending on how long the loadImage request takes. |
Looks good to me! Indeed scrollToIndex just queues it up. |
|
Thanks @adreyfus I don't know why it wasn't clear that the build was failing before I merged that... |
Sorry about that, I didn't see that either when building. |
I wanted a way to consume scroll events and prevent the stack state from progressing to the next index until the currently request index had been drawn. I think this covers that.