Fixed the bug of the selected range on canvas