Creating a map canvas event handler