Improve mouse logic for measure tool. Fix for #4628, #10029
Merge pull request #1444 from avlisad/master

Improve mouse logic for measure tool. Fix #4628 Fix #10029