catch corner case where pos.left/pos.top can be NaN which is > 0

I was running into a bug where `pos.top` is `NaN` and `minTop` is negative, so `pos.top` never gets correctly set. This fixes this issue.