Introduce & propagate legendimageloaded-event.

This PR superseedes #230, which has a messed up diff.