improved object leaving canvas detection