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
Fix home bounds with clipping. Fix #891 #910
Conversation
The code looks reasonable, but I don't understand how Also, I don't think those functions should be taking clipping into account anyway...we need to still mostly think in terms of the whole unclipped image, unless we want to dramatically change how we do things. Anyway, set me straight :) |
Ha yes this is hard to spot in the diff. So, all the viewport._contentXXX fields now take clipping into account. As you said we don't want the conversion methods to take clipping into account so we can't rely on them (at least for conversion, they are still useful to compute viewport constraints and default zoom). So I modified the viewport/image conversion methods to always call the tiledImage ones. |
I checked if we are always checking for this.viewer existence before using it. It wouldn't make sense to call the last four if there is no viewer though. |
I see! That makes a lot of sense... pretty subtle! Yeah, I'm not sure where the idea that there could be a viewport without a viewer came in... that was before I got back on the project. I kinda feel like we don't really need to support that scenario, though I suppose it could be handy if you just wanted to use our viewport but do all of your own drawing. What do you think? |
I really don't have much opinion on this. I can't think of a case where I would use just the viewport in a project but I don't mind adding the missing tests or removing all of them (and add an assert in the constructor that a viewer is specified). |
Well, looks like I do in fact use a viewport without a viewer here: ... but that was written before we had multi-image; if I were to do it today I would just use multi-image instead. Anyway, since there are so few tests to add, we might as well keep it up, for now at least. Sound fair? |
I added a test in setMargins.
|
I think I'm in favor of logging an error and returning an incorrect value (i.e. 0). Calling those if you don't have a viewer is a programmer error. |
... Or you could just stick a |
Done! |
Excellent :) |
I had to modify the
Viewport.viewportToImage
conversion methods to always use theTiledImage.viewportToImage
methods in order for clipping to be taken into account.