Use layerX instead of clientX

1. Use layerX instead of clientX
2. Rename event handler
3. Use function expression instead of function declaration
4. Optimize code path of selectDistrict