Fixed a bug of dragging a cursor to negative values