diff --git a/src/app/gui/canvas.cc b/src/app/gui/canvas.cc index 00af8ffc..9e7c169c 100644 --- a/src/app/gui/canvas.cc +++ b/src/app/gui/canvas.cc @@ -394,11 +394,14 @@ void Canvas::DrawTileOnBitmap(int tile_size, gfx::Bitmap *bitmap, } } -bool Canvas::DrawTileSelector(int size) { +bool Canvas::DrawTileSelector(int size, int size_y) { const ImGuiIO &io = GetIO(); const bool is_hovered = IsItemHovered(); const ImVec2 origin(canvas_p0_.x + scrolling_.x, canvas_p0_.y + scrolling_.y); const ImVec2 mouse_pos(io.MousePos.x - origin.x, io.MousePos.y - origin.y); + if (size_y == 0) { + size_y = size; + } if (is_hovered && IsMouseClicked(ImGuiMouseButton_Left)) { if (!points_.empty()) { @@ -409,7 +412,7 @@ bool Canvas::DrawTileSelector(int size) { painter_pos.y = std::floor((double)mouse_pos.y / size) * size; points_.push_back(painter_pos); - points_.push_back(ImVec2(painter_pos.x + size, painter_pos.y + size)); + points_.push_back(ImVec2(painter_pos.x + size, painter_pos.y + size_y)); mouse_pos_in_canvas_ = painter_pos; } diff --git a/src/app/gui/canvas.h b/src/app/gui/canvas.h index 5d5b44eb..61c74b9d 100644 --- a/src/app/gui/canvas.h +++ b/src/app/gui/canvas.h @@ -103,7 +103,7 @@ class Canvas : public SharedRom { // Dictates which tile is currently selected based on what the user clicks // in the canvas window. Represented and split apart into a grid of tiles. - bool DrawTileSelector(int size); + bool DrawTileSelector(int size, int size_y = 0); // Draws the selection rectangle when the user is selecting multiple tiles void DrawSelectRect(int current_map, int tile_size = 0x10,