- boxX = Math.round((float) startRes * width / alwidth);
- boxY = Math.round((float) startSeq * sequencesHeight / alheight);
+ int xPos = Math.min(startRes, alwidth - vpwidth + 1);
+ boxX = Math.round(xPos / widthRatio);
+ boxY = Math.round(startSeq / heightRatio);