1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-01 04:43:37 +02:00

made constrainworldbounds return if it constrained

This commit is contained in:
Ellpeck 2019-12-26 13:01:32 +01:00
parent 937b1757fe
commit f4db1be464

View file

@ -70,7 +70,8 @@ namespace MLEM.Cameras {
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) {
this.LookingPosition = new Vector2((max.X - min.X) / 2, this.LookingPosition.Y);
} else {
@ -88,6 +89,7 @@ namespace MLEM.Cameras {
if (this.Max.Y > 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) {