1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 22:48:34 +01: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); 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) {