Better width/height calculation.
Better mouse event handling.
Merge branch 'zhipeng-jia'