- [FIX] Si està escribint un text, que no pille la D o la M com a "duplicar" o "moure" el actor seleccionat

This commit is contained in:
2024-10-08 08:08:17 +02:00
parent 77cdf90c99
commit 119136332b

View File

@@ -339,7 +339,9 @@ namespace modules
room::draw();
actor::actor_t *selected = actor::getSelected();
if (editor::isDevMode() && selected && input::keyPressed(SDL_SCANCODE_M)) actor::setFloatingEditing(true);
const bool inside_room_zone = (draw::getLocalX(input::mouseX())>=0 && draw::getLocalY(input::mouseY())>=0 && draw::getLocalX(input::mouseX())<320 && draw::getLocalY(input::mouseY())<240);
if (editor::isDevMode() && selected && inside_room_zone && input::keyPressed(SDL_SCANCODE_M)) actor::setFloatingEditing(true);
if (editor::isDevMode() && actor::getFloatingEditing() && selected) {
draw::swapcol(1, GREEN+LIGHT);
@@ -667,8 +669,7 @@ namespace modules
}
draw::setViewport(420, 15, 100, 225);
mx = draw::getLocalX(input::mouseX());
my = draw::getLocalY(input::mouseY());
bool changed = false;
@@ -898,7 +899,7 @@ namespace modules
draw::color(PAPER);
draw::rect(2, 0, 96, 204);
if (ui::button("DUPLICATE", 2, line, 48, 11) || input::keyPressed(SDL_SCANCODE_D))
if (ui::button("DUPLICATE", 2, line, 48, 11) || ( input::keyPressed(SDL_SCANCODE_D) && inside_room_zone))
{
actor::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_act);
@@ -908,7 +909,7 @@ namespace modules
actor::setFloatingEditing(true);
changed = true;
}
if (ui::button("DELETE", 48, line, 48, 11) || input::keyPressed(SDL_SCANCODE_DELETE))
if (ui::button("DELETE", 48, line, 48, 11) || ( input::keyPressed(SDL_SCANCODE_DELETE) && inside_room_zone))
{
actor::remove(act);
act = nullptr;