Skip to content

Commit

Permalink
VOXEDIT: fixed off-by-one in text brush region calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed May 29, 2024
1 parent 2a60354 commit 1965b7a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ voxel::Region TextBrush::calcRegion(const BrushContext &context) const {
int dimX = 0;
int dimY = 0;
_voxelFont.dimensions(_input.c_str(), _size, dimX, dimY);
const int w = l * _spacing + dimX;
const int w = core_max(0, (l - 1)) * _spacing + dimX;
const int h = dimY;
const int d = _thickness;
const glm::ivec3 &mins = context.cursorPosition;
glm::ivec3 maxs = mins;
const int widthIndex = math::getIndexForAxis(_axis);
maxs[(widthIndex + 0) % 3] += w;
maxs[(widthIndex + 1) % 3] += h;
maxs[(widthIndex + 2) % 3] += d;
maxs[(widthIndex + 0) % 3] += (w - 1);
maxs[(widthIndex + 1) % 3] += (h - 1);
maxs[(widthIndex + 2) % 3] += (d - 1);
return voxel::Region(mins, maxs);
}

Expand Down

0 comments on commit 1965b7a

Please sign in to comment.