-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
issue 923 allow search results paging on single page #1053
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
A couple of comments on this:
1.) I'm wondering if this special case is masking a different/larger bug. I'm not sure why we need to account for having just one canvas differently. If there's only one canvas, then shouldn't currentCanvasIndex equal lastSearchResultCanvasIndex? And if that's the case, how is it any different from being on the last page of a multi-page result? If that's not the case, then maybe there's a bug related to determining the current index, or in one of the other comparisons, and we'd be better off fixing that underlying problem instead of adding a workaround at the end.
2.) If we do indeed need to keep this code as-is, some minor stylistic changes are needed --
return true
is missing a semi-colon, and the closing brace needs to be dropped to the next line. I'm guessing that perhaps a couple of characters were accidentally deleted here, but Javascript is tolerant enough that it works anyway. :-)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.
Thanks for taking a look Demian. This did cross my mind, but currently the only logic that activates the next button in the first instance is the final return statement of this method (now line 388). The block above it is relevant only when an annotation is 'current' (after 'next' is pressed for the first time), and then it's checking that it is neither the last page or the last annotation. So my change is essentially just adding another condition to check for along with line 388. This is hard to explain! But we can discuss on the next UV call.
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 see -- but I still wonder if there's a more general solution to this problem. Is it possible that there's another edge case involving
(<OpenSeadragonExtension>this.extension).currentAnnotationRect
that isn't being properly taken into account? I would think that if there is no current rectangle, but there are highlighted search results, we would want to allow the next button to be active. Additionally, if there is only one canvas but the user has navigated to the last highlighted search result, we would NOT want the next button to be active, but I think with this current code it will never get disabled.We should also double check that any changes we make to the "next" logic do not have matching bugs in the "previous" logic.
As you say, we can discuss further on the call -- this logic is definitely a bit hard to wrap one's head around!
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.
The more streamlined solution worked so I've edited the PR. Thanks Demian!