Pass selected layer with map:moved event
Remove obsolete visibility check
Fix indentation