void (@NotNull VisibleAreaEvent e) { Rectangle oldRect = e.getOldRectangle(); Rectangle newRect = e.getNewRectangle(); CancellablePromise<?> promise = myCancellablePromiseRef.get(); if (oldRect != null && (oldRect.x != newRect.x || oldRect.y != newRect.y) && promise != null) { promise.cancel(); } }