add DrawCustomHighlight to Canvas
This commit is contained in:
@@ -647,6 +647,7 @@ void Canvas::DrawInfoGrid(float grid_step, int tile_id_offset, int label_id) {
|
|||||||
grid_step *= global_scale_; // Apply global scale to grid step
|
grid_step *= global_scale_; // Apply global scale to grid step
|
||||||
|
|
||||||
DrawGridLines(grid_step);
|
DrawGridLines(grid_step);
|
||||||
|
DrawCustomHighlight(grid_step);
|
||||||
|
|
||||||
if (enable_custom_labels_) {
|
if (enable_custom_labels_) {
|
||||||
// Draw the contents of labels on the grid
|
// Draw the contents of labels on the grid
|
||||||
@@ -672,15 +673,7 @@ void Canvas::DrawInfoGrid(float grid_step, int tile_id_offset, int label_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Canvas::DrawGrid(float grid_step, int tile_id_offset) {
|
void Canvas::DrawCustomHighlight(float grid_step) {
|
||||||
// Draw grid + all lines in the canvas
|
|
||||||
draw_list_->PushClipRect(canvas_p0_, canvas_p1_, true);
|
|
||||||
if (enable_grid_) {
|
|
||||||
if (custom_step_ != 0.f) grid_step = custom_step_;
|
|
||||||
grid_step *= global_scale_; // Apply global scale to grid step
|
|
||||||
|
|
||||||
DrawGridLines(grid_step);
|
|
||||||
|
|
||||||
if (highlight_tile_id != -1) {
|
if (highlight_tile_id != -1) {
|
||||||
int tile_x = highlight_tile_id % 8;
|
int tile_x = highlight_tile_id % 8;
|
||||||
int tile_y = highlight_tile_id / 8;
|
int tile_y = highlight_tile_id / 8;
|
||||||
@@ -691,6 +684,17 @@ void Canvas::DrawGrid(float grid_step, int tile_id_offset) {
|
|||||||
draw_list_->AddRectFilled(tile_pos, tile_pos_end,
|
draw_list_->AddRectFilled(tile_pos, tile_pos_end,
|
||||||
IM_COL32(255, 0, 255, 255));
|
IM_COL32(255, 0, 255, 255));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Canvas::DrawGrid(float grid_step, int tile_id_offset) {
|
||||||
|
// Draw grid + all lines in the canvas
|
||||||
|
draw_list_->PushClipRect(canvas_p0_, canvas_p1_, true);
|
||||||
|
if (enable_grid_) {
|
||||||
|
if (custom_step_ != 0.f) grid_step = custom_step_;
|
||||||
|
grid_step *= global_scale_; // Apply global scale to grid step
|
||||||
|
|
||||||
|
DrawGridLines(grid_step);
|
||||||
|
DrawCustomHighlight(grid_step);
|
||||||
|
|
||||||
if (enable_hex_tile_labels_) {
|
if (enable_hex_tile_labels_) {
|
||||||
// Draw the hex ID of the tile in the center of the tile square
|
// Draw the hex ID of the tile in the center of the tile square
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class Canvas : public SharedRom {
|
|||||||
canvas_sz_ = canvas_size;
|
canvas_sz_ = canvas_size;
|
||||||
custom_canvas_size_ = true;
|
custom_canvas_size_ = true;
|
||||||
}
|
}
|
||||||
|
void DrawCustomHighlight(float grid_step);
|
||||||
bool IsMouseHovering() const { return is_hovered_; }
|
bool IsMouseHovering() const { return is_hovered_; }
|
||||||
void ZoomIn() { global_scale_ += 0.25f; }
|
void ZoomIn() { global_scale_ += 0.25f; }
|
||||||
void ZoomOut() { global_scale_ -= 0.25f; }
|
void ZoomOut() { global_scale_ -= 0.25f; }
|
||||||
|
|||||||
Reference in New Issue
Block a user