Navigation Menu

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

Fix viewport.applyContraints (#833) #846

Merged
merged 7 commits into from Feb 18, 2016

Conversation

avandecreme
Copy link
Member

The goal of this PR is to #833 at some point.
Depending on what you prefer, you can merge now or when the fix is ready.

@avandecreme avandecreme changed the title Rename this.homeBounds to this._contentBounds. Fix viewport.applyContraints (#833) Feb 15, 2016
@avandecreme
Copy link
Member Author

Found a fix. There is obviously matter for discussion :)

return this;
},

/**
* Updates the viewport's home bounds and constraints.
* Updates the viewport's content bounds and constraints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference for deprecated functions is to remove their doc comments entirely. Just replace with:

// deprecated

...or some such.

@iangilman
Copy link
Member

It's a lot of changes, but most of it is code clean up. All seems reasonable to me. What were you thinking should be discussed? For that matter, could you describe what the issue was and how you fixed it?

Also, since there are deprecations, maybe it makes sense for you to write the changelog for this one, calling out the items that were deprecated.

@avandecreme
Copy link
Member Author

What were you thinking should be discussed?

For that matter, could you describe what the issue was and how you fixed it?

The issue was that _applyBoundaryConstraints was using the rotated content bounds instead of the non-rotated one.
So some methods need the rotated bounds and others the non-rotated ones. So I now save both in _worldContentBounds (non-rotated) and _contentBounds (rotated).
Sorry for having buried the fix with all the code clean up. I did it to understand what was going on.

Also, since there are deprecations, maybe it makes sense for you to write the changelog for this one, calling out the items that were deprecated.

Sure, will do.

@iangilman
Copy link
Member

Awesome, thanks for the explanations!

Variable names. Are you ok with worldContentBounds? The idea is that it is in world coordinates instead of viewport coordinates. This could also be named contentBoundsNoRotate.

Hmm, now that you mention it, I think I prefer contentBoundsNoRotate; that's more explicit, and I'm not comfortable saying that world bounds are a different coordinate system than viewport bounds. We already have enough coordinate systems! I think it's better to say that the viewport is rotated within the same coordinate system it shares with the world.

Do you know about this TODO: https://github.com/openseadragon/openseadragon/pull/846/files#diff-7f04a433d8bd9a31fbfc7d21bedc46e1R137

It looks like we're not using the contentBounds option, and it's not documented, so we can kill it (though it might still merit a notice in the changelog just in case someone has been using undocumented features). I think it's left over from we had a single image and wouldn't even create the viewport until we had created that image. Those days are long gone!

In world.js, should we rename homeBounds to contentBounds?

I suppose this might be more consistent, but I don't think it's a big deal (it's a different context than viewport), and the API already has getHomeBounds, so I guess I'd be in favor of leaving it as is to avoid API churn.

@avandecreme
Copy link
Member Author

This should be ready :)

@iangilman
Copy link
Member

Looks lovely!

iangilman added a commit that referenced this pull request Feb 18, 2016
Fix viewport.applyContraints (#833)
@iangilman iangilman merged commit 458bbd6 into openseadragon:master Feb 18, 2016
@avandecreme avandecreme deleted the rotation branch April 21, 2016 15:14
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

Successfully merging this pull request may close these issues.

None yet

2 participants