[core] Updated Size::isEmpty and TransformState::valid checks

This commit is contained in:
Bruno de Oliveira Abinader
2017-04-03 17:07:17 +03:00
parent 76edc6ee69
commit e5aa4d70cd
10 changed files with 87 additions and 42 deletions

View File

@@ -45,9 +45,13 @@ Transform::Transform(MapObserver& observer_,
#pragma mark - Map View
bool Transform::resize(const Size size) {
void Transform::resize(const Size size) {
if (size.isEmpty()) {
throw std::runtime_error("failed to resize: size is empty");
}
if (state.size == size) {
return false;
return;
}
observer.onCameraWillChange(MapObserver::CameraChangeMode::Immediate);
@@ -56,8 +60,6 @@ bool Transform::resize(const Size size) {
state.constrain(state.scale, state.x, state.y);
observer.onCameraDidChange(MapObserver::CameraChangeMode::Immediate);
return true;
}
#pragma mark - Camera