As someone already answered in the copy of this question on StackOverflow, it is much more efficient to iterate over all images in your site, and check for each one if it overlaps the selection, than to iterate all points in the selection (we're talking hundreds of thousands for a moderate selection) and check the existence of images on each one.
This answer This answer provides an example solution. It's written with jQuery but it should be adaptable to vanilla JavaScript.
As someone already answered in the copy of this question on StackOverflow, it is much more efficient to iterate over all images in your site, and check for each one if it overlaps the selection, than to iterate all points in the selection (we're talking hundreds of thousands for a moderate selection) and check the existence of images on each one.
This answer provides an example solution. It's written with jQuery but it should be adaptable to vanilla JavaScript.
As someone already answered in the copy of this question on StackOverflow, it is much more efficient to iterate over all images in your site, and check for each one if it overlaps the selection, than to iterate all points in the selection (we're talking hundreds of thousands for a moderate selection) and check the existence of images on each one.
This answer provides an example solution. It's written with jQuery but it should be adaptable to vanilla JavaScript.
As someone already answered in the copy of this question on StackOverflow, it is much more efficient to iterate over all images in your site, and check for each one if it overlaps the selection, than to iterate all points in the selection (we're talking hundreds of thousands for a moderate selection) and check the existence of images on each one.
This answer provides an example solution. It's written with jQuery but it should be adaptable to vanilla JavaScript.