mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-23 05:08:34 +01:00
made constrainworldbounds return if it constrained
This commit is contained in:
parent
937b1757fe
commit
f4db1be464
1 changed files with 3 additions and 1 deletions
|
@ -70,7 +70,8 @@ namespace MLEM.Cameras {
|
||||||
return new RectangleF(start, this.ToWorldPos(new Vector2(this.Viewport.Width, this.Viewport.Height)) - start);
|
return new RectangleF(start, this.ToWorldPos(new Vector2(this.Viewport.Width, this.Viewport.Height)) - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConstrainWorldBounds(Vector2 min, Vector2 max) {
|
public bool ConstrainWorldBounds(Vector2 min, Vector2 max) {
|
||||||
|
var lastPos = this.Position;
|
||||||
if (this.Position.X < min.X && this.Max.X > max.X) {
|
if (this.Position.X < min.X && this.Max.X > max.X) {
|
||||||
this.LookingPosition = new Vector2((max.X - min.X) / 2, this.LookingPosition.Y);
|
this.LookingPosition = new Vector2((max.X - min.X) / 2, this.LookingPosition.Y);
|
||||||
} else {
|
} else {
|
||||||
|
@ -88,6 +89,7 @@ namespace MLEM.Cameras {
|
||||||
if (this.Max.Y > max.Y)
|
if (this.Max.Y > max.Y)
|
||||||
this.Max = new Vector2(this.Max.X, max.Y);
|
this.Max = new Vector2(this.Max.X, max.Y);
|
||||||
}
|
}
|
||||||
|
return !this.Position.Equals(lastPos, 0.001F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Zoom(float delta, Vector2? zoomCenter = null) {
|
public void Zoom(float delta, Vector2? zoomCenter = null) {
|
||||||
|
|
Loading…
Reference in a new issue