palettes and overworld drawing
This commit is contained in:
@@ -37,15 +37,14 @@ void Canvas::DrawContextMenu() {
|
||||
io.MousePos.y - origin.y);
|
||||
|
||||
// Add first and second point
|
||||
if (is_hovered && !dragging_select_ &&
|
||||
ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
|
||||
points_.push_back(mouse_pos_in_canvas);
|
||||
points_.push_back(mouse_pos_in_canvas);
|
||||
dragging_select_ = true;
|
||||
}
|
||||
if (dragging_select_) {
|
||||
points_.back() = mouse_pos_in_canvas;
|
||||
if (!ImGui::IsMouseDown(ImGuiMouseButton_Left)) dragging_select_ = false;
|
||||
if (is_hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
|
||||
ImVec2 draw_tile_outline_pos;
|
||||
draw_tile_outline_pos.x = std::round((double)mouse_pos_in_canvas.x / 32) * 32;
|
||||
draw_tile_outline_pos.y = std::round((double)mouse_pos_in_canvas.y / 32) * 32;
|
||||
|
||||
points_.push_back(draw_tile_outline_pos);
|
||||
points_.push_back(
|
||||
ImVec2(draw_tile_outline_pos.x + 32, draw_tile_outline_pos.y + 32));
|
||||
}
|
||||
|
||||
// Pan (we use a zero mouse threshold when there's no context menu)
|
||||
@@ -62,8 +61,6 @@ void Canvas::DrawContextMenu() {
|
||||
ImGui::OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight);
|
||||
|
||||
if (ImGui::BeginPopup("context")) {
|
||||
if (dragging_select_) points_.resize(points_.size() - 2);
|
||||
dragging_select_ = false;
|
||||
if (ImGui::MenuItem("Remove all", nullptr, false, points_.Size > 0)) {
|
||||
points_.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user