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 the panic when transform is non-invertible #823

Merged
merged 1 commit into from Feb 2, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -119,7 +119,16 @@ impl Layer {
pub fn update_transform(&mut self,
parent_world_transform: &ScrollToWorldTransform,
parent_viewport_rect: &ScrollLayerRect) {
let inv_transform = self.local_transform.inverse().unwrap();
let inv_transform = match self.local_transform.inverse() {
Some(transform) => transform,
None => {
// If a transform function causes the current transformation matrix of an object
// to be non-invertible, the object and its content do not get displayed.
self.combined_local_viewport_rect = LayerRect::zero();
return;
}
};

let parent_viewport_rect_in_local_space = inv_transform.transform_rect(parent_viewport_rect)
.translate(&-self.scrolling.offset);
let local_viewport_rect = self.local_viewport_rect.translate(&-self.scrolling.offset);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.