Skip to content

Commit

Permalink
Zoom changed event is now fired after changing the zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen-wilke committed Apr 7, 2020
1 parent d9b5a03 commit 0deffc4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/de/gurkenlabs/litiengine/graphics/Camera.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,17 @@ public void setFocus(double x, double y) {
@Override
public void setZoom(final float targetZoom, final int delay) {
if (delay == 0) {
final ZoomChangedEvent event = new ZoomChangedEvent(this, targetZoom);
for (final ZoomChangedListener listener : this.zoomListeners) {
listener.zoomChanged(event);
}

this.zoom = targetZoom;
this.targetZoom = 0;
this.zoomDelay = 0;
this.zoomTick = 0;
this.zoomStep = 0;

final ZoomChangedEvent event = new ZoomChangedEvent(this, targetZoom);
for (final ZoomChangedListener listener : this.zoomListeners) {
listener.zoomChanged(event);
}
} else {
this.zoomTick = Game.time().now();
this.targetZoom = targetZoom;
Expand Down

0 comments on commit 0deffc4

Please sign in to comment.