Skip to content

Commit 5e19352

Browse files
committed
add option to disable shift/control in scale/rotate & fix alpha's pr
1 parent c922526 commit 5e19352

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# BetterEdit 6
22

33
## v6.10.0-alpha.9
4+
* <cg>MacOS support!</c>
5+
* Add option to disable shift/control keys in <co>Scale</c> and <cj>Rotate</c> controls
46
* Fix crash scaling objects pt. 2
7+
* Fix build tabs sometimes disappearing
58

69
## v6.10.0-alpha.8
710
* Add <cp>Playtest Pause/Resume</c> keybind

mod.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@
150150
"name": "New Color Menu",
151151
"description": "Changes the object color selection menu to show more channels aswell as previews for colors and special colors"
152152
},
153+
"scale-rotate-input-modifier-keys": {
154+
"type": "bool",
155+
"default": true,
156+
"name": "Enable Shift/Control on Scale Input",
157+
"description": "When holding the <cp>Shift</c> key, toggles snapping in the <co>Scale</c> and <cj>Rotate</c> controls, and when holding <cp>Control</c> toggles absolute position"
158+
},
153159
"larger-color-menu": {
154160
"type": "bool",
155161
"default": {

src/features/ImprovedScaleAndRotate.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ class $modify(SnappableScaleControl, GJScaleControl) {
264264
}
265265

266266
void updateShiftAndControl(float) {
267+
if (!Mod::get()->getSettingValue<bool>("scale-rotate-input-modifier-keys")) {
268+
return;
269+
}
267270
handleLockModifierState<0>(CCKeyboardDispatcher::get()->getShiftKeyPressed(), this->getSnapLock());
268271

269272
static bool stateOverwrittenViaModifier = false;
@@ -484,6 +487,9 @@ class $modify(InputRotationControl, GJRotationControl) {
484487
}
485488

486489
void updateShiftAndControl(float) {
490+
if (!Mod::get()->getSettingValue<bool>("scale-rotate-input-modifier-keys")) {
491+
return;
492+
}
487493
handleLockModifierState<1>(CCKeyboardDispatcher::get()->getShiftKeyPressed(), this->getSnapLock());
488494
handleLockModifierState<2>(CCKeyboardDispatcher::get()->getControlKeyPressed(), this->getPosLock());
489495
}

src/features/scaling/EditorUIScaling.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ class $modify(BetterEditButtonBar, EditButtonBar) {
2323

2424
$override
2525
void loadFromItems(CCArray* items, int c, int r, bool persist) {
26-
2726
EditButtonBar::loadFromItems(items, c, r, persist);
2827

2928
// do not update if no change is made to prevent lag
3029
if (m_fields->m_cols == c && m_fields->m_rows == r && !persist) return;
3130

3231
m_fields->m_cols = c;
3332
m_fields->m_rows = r;
34-
updateUI(persist);
33+
updateUI();
3534
}
3635

37-
void updateUI(bool persist) {
38-
39-
EditButtonBar::loadFromItems(m_buttonArray, m_fields->m_cols, m_fields->m_rows, persist);
36+
void updateUI() {
37+
EditButtonBar::loadFromItems(m_buttonArray, m_fields->m_cols, m_fields->m_rows, false);
4038
if (auto ui = typeinfo_cast<EditorUI*>(getParent())) {
4139
// fix visible pages when opening editor, can be assumed as 0 as loadFromItems resets the page to 0
4240
for (auto barPages : CCArrayExt<CCNode*>(m_pagesArray)) {
@@ -248,7 +246,7 @@ class $modify(ScaledUI, EditorUI) {
248246
// Reload EditButtonBars to recenter
249247
for (auto c : CCArrayExt<CCNode*>(this->getChildren())) {
250248
if (auto bar = typeinfo_cast<EditButtonBar*>(c)) {
251-
static_cast<BetterEditButtonBar*>(bar)->updateUI(true);
249+
static_cast<BetterEditButtonBar*>(bar)->updateUI();
252250
}
253251
}
254252

0 commit comments

Comments
 (0)