diff --git a/changelog.md b/changelog.md index e7d3a08..b99d865 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * View tab * Better organized edit tab * Hide UI button + * 1/4 and 1/8 moving is now relative to the current grid size ## v6.3.5 diff --git a/src/features/MoveMenu.cpp b/src/features/MoveMenu.cpp index da898b4..99108de 100644 --- a/src/features/MoveMenu.cpp +++ b/src/features/MoveMenu.cpp @@ -261,10 +261,10 @@ class CustomEditMenu : public CCNode { ) { std::string name; switch (hash(group.c_str())) { - case hash("half-button"): name = "1/2"; break; - case hash("quarter-button"): name = "1/4"; break; - case hash("eighth-button"): name = "1/8"; break; - case hash("unit-button"): name = "1/30"; break; + case hash("half-button"): name = "1/2"; break; + case hash("quarter-button"): name = "1/4"; break; + case hash("eighth-button"): name = "1/8"; break; + case hash("unit-button"): name = "Pixel"; break; default: break; } m_groups.push_back(MoveGroup::create(name, up, down, left, right)); @@ -322,6 +322,11 @@ class $modify(EditorUI) { m_editButtonBar->m_buttonArray->addObject(btn); } + $override + void clickOnPosition(CCPoint pos) { + EditorUI::clickOnPosition(pos); + CustomEditMenu::updateVisiblity(this); + } $override void toggleMode(CCObject* sender) { EditorUI::toggleMode(sender); diff --git a/src/utils/EditCommandExt.cpp b/src/utils/EditCommandExt.cpp index f3eb3f4..6960650 100644 --- a/src/utils/EditCommandExt.cpp +++ b/src/utils/EditCommandExt.cpp @@ -6,21 +6,22 @@ class $modify(EditorUI) { BE_ALLOW_START BE_ALLOW_FAKE_ENUMS CCPoint moveForCommand(EditCommand command) { + auto gridSize = EditorUI::get()->m_gridSize; switch (command) { - case EditCommandExt::QuarterLeft: return ccp(-7.5f, 0); - case EditCommandExt::QuarterRight: return ccp(7.5f, 0); - case EditCommandExt::QuarterUp: return ccp(0, 7.5f); - case EditCommandExt::QuarterDown: return ccp(0, -7.5f); - - case EditCommandExt::EighthLeft: return ccp(-3.75f, 0); - case EditCommandExt::EighthRight: return ccp(3.75f, 0); - case EditCommandExt::EighthUp: return ccp(0, 3.75f); - case EditCommandExt::EighthDown: return ccp(0, -3.75f); + case EditCommandExt::QuarterLeft: return ccp(-1 / 4.f, 0) * gridSize; + case EditCommandExt::QuarterRight: return ccp( 1 / 4.f, 0) * gridSize; + case EditCommandExt::QuarterUp: return ccp(0, 1 / 4.f) * gridSize; + case EditCommandExt::QuarterDown: return ccp(0, -1 / 4.f) * gridSize; - case EditCommandExt::UnitLeft: return ccp(-1, 0); - case EditCommandExt::UnitRight: return ccp(1, 0); - case EditCommandExt::UnitUp: return ccp(0, 1); - case EditCommandExt::UnitDown: return ccp(0, -1); + case EditCommandExt::EighthLeft: return ccp(-1 / 8.f, 0) * gridSize; + case EditCommandExt::EighthRight: return ccp( 1 / 8.f, 0) * gridSize; + case EditCommandExt::EighthUp: return ccp(0, 1 / 8.f) * gridSize; + case EditCommandExt::EighthDown: return ccp(0, -1 / 8.f) * gridSize; + + case EditCommandExt::UnitLeft: return ccp(-.1f, 0); + case EditCommandExt::UnitRight: return ccp( .1f, 0); + case EditCommandExt::UnitUp: return ccp( 0, .1f); + case EditCommandExt::UnitDown: return ccp( 0, -.1f); default: return EditorUI::moveForCommand(command); }