99using namespace geode ::prelude;
1010using namespace keybinds ;
1111
12- // TODO: move this to header in 1.2.0
13-
14- class EvilBypass : public CCKeyboardDispatcher {
15- public:
16- bool setControlPressed (bool pressed) {
17- auto old = m_bControlPressed;
18- m_bControlPressed = pressed;
19- return old;
20- }
21- bool setCommandPressed (bool pressed) {
22- auto old = m_bCommandPressed;
23- m_bCommandPressed = pressed;
24- return old;
25- }
26- bool setShiftPressed (bool pressed) {
27- auto old = m_bShiftPressed;
28- m_bShiftPressed = pressed;
29- return old;
30- }
31- bool setAltPressed (bool pressed) {
32- auto old = m_bAltPressed;
33- m_bAltPressed = pressed;
34- return old;
35- }
36- };
37-
3812struct $modify(EditorPauseLayer) {
3913 static void onModify (auto & self) {
4014 (void )self.setHookPriority (" EditorPauseLayer::keyDown" , 1000 );
@@ -129,28 +103,28 @@ struct $modify(EditorUI) {
129103 this ->passThroughKeyDown (KEY_Delete);
130104 });
131105 this ->defineKeybind (" robtop.geometry-dash/undo" , [this ] {
132- this ->passThroughKeyDown (KEY_Z, Modifier::PlatformControl );
106+ this ->passThroughKeyDown (KEY_Z, Modifier::Control );
133107 });
134108 this ->defineKeybind (" robtop.geometry-dash/redo" , [this ] {
135- this ->passThroughKeyDown (KEY_Z, Modifier::PlatformControl | Modifier::Shift);
109+ this ->passThroughKeyDown (KEY_Z, Modifier::Control | Modifier::Shift);
136110 });
137111 this ->defineKeybind (" robtop.geometry-dash/deselect-all" , [this ] {
138112 this ->passThroughKeyDown (KEY_D, Modifier::Alt);
139113 });
140114 this ->defineKeybind (" robtop.geometry-dash/copy" , [this ] {
141- this ->passThroughKeyDown (KEY_C, Modifier::PlatformControl );
115+ this ->passThroughKeyDown (KEY_C, Modifier::Control );
142116 });
143117 this ->defineKeybind (" robtop.geometry-dash/paste" , [this ] {
144- this ->passThroughKeyDown (KEY_V, Modifier::PlatformControl );
118+ this ->passThroughKeyDown (KEY_V, Modifier::Control );
145119 });
146120 this ->defineKeybind (" robtop.geometry-dash/copy-paste" , [this ] {
147- this ->passThroughKeyDown (KEY_D, Modifier::PlatformControl );
121+ this ->passThroughKeyDown (KEY_D, Modifier::Control );
148122 });
149123 this ->defineKeybind (" robtop.geometry-dash/toggle-rotate" , [this ] {
150124 this ->passThroughKeyDown (KEY_R);
151125 });
152126 this ->defineKeybind (" robtop.geometry-dash/toggle-transform" , [this ] {
153- this ->passThroughKeyDown (KEY_T, Modifier::PlatformControl );
127+ this ->passThroughKeyDown (KEY_T, Modifier::Control );
154128 });
155129 this ->defineKeybind (" robtop.geometry-dash/toggle-free-move" , [this ] {
156130 this ->passThroughKeyDown (KEY_F);
@@ -166,7 +140,7 @@ struct $modify(EditorUI) {
166140 });
167141 this ->defineKeybind (" robtop.geometry-dash/playback-music" , [this ] {
168142 // RobTop broke this in 2.2, which makes it trigger the playtest keybind
169- // this->passThroughKeyDown(KEY_Enter, Modifier::PlatformControl );
143+ // this->passThroughKeyDown(KEY_Enter, Modifier::Control );
170144 EditorUI::onPlayback (nullptr );
171145 });
172146 this ->defineKeybind (" robtop.geometry-dash/prev-build-tab" , [this ] {
@@ -249,7 +223,7 @@ struct $modify(EditorUI) {
249223 auto x = std::to_string (i);
250224 auto key = static_cast <enumKeyCodes>(KEY_Zero + i);
251225 this ->defineKeybind (" robtop.geometry-dash/save-editor-position-" + x, [this , key] {
252- this ->passThroughKeyDown (key, Modifier::PlatformControl );
226+ this ->passThroughKeyDown (key, Modifier::Control );
253227 });
254228 this ->defineKeybind (" robtop.geometry-dash/load-editor-position-" + x, [this , key] {
255229 this ->passThroughKeyDown (key, Modifier::Alt);
@@ -298,16 +272,20 @@ struct $modify(EditorUI) {
298272
299273 void passThroughKeyDown (enumKeyCodes key, Modifier modifiers = Modifier::None) {
300274 s_allowPassThrough = true ;
301- auto d = static_cast <EvilBypass*>(CCKeyboardDispatcher::get ());
302- auto alt = d->setAltPressed (modifiers & Modifier::Alt);
303- auto shift = d->setShiftPressed (modifiers & Modifier::Shift);
304- auto ctrl = d->setControlPressed (modifiers & Modifier::Control);
305- auto cmd = d->setCommandPressed (modifiers & Modifier::Command);
275+ auto d = CCKeyboardDispatcher::get ();
276+ auto alt = d->m_bAltPressed ;
277+ auto shift = d->m_bShiftPressed ;
278+ auto ctrl = d->m_bControlPressed ;
279+ auto cmd = d->m_bCommandPressed ;
280+ d->m_bAltPressed = modifiers & Modifier::Alt;
281+ d->m_bShiftPressed = modifiers & Modifier::Shift;
282+ d->m_bControlPressed = modifiers & Modifier::Control;
283+ d->m_bCommandPressed = modifiers & Modifier::Command;
306284 this ->keyDown (key);
307- d->setAltPressed ( alt) ;
308- d->setShiftPressed ( shift) ;
309- d->setControlPressed ( ctrl) ;
310- d->setCommandPressed ( cmd) ;
285+ d->m_bAltPressed = alt;
286+ d->m_bShiftPressed = shift;
287+ d->m_bControlPressed = ctrl;
288+ d->m_bCommandPressed = cmd;
311289 }
312290
313291 void keyDown (enumKeyCodes key) {
@@ -325,6 +303,15 @@ struct $modify(EditorUI) {
325303 EditorUI::keyUp (key);
326304 }
327305 }
306+ #ifdef GEODE_IS_MACOS // Editor zooming hack
307+ void scrollWheel (float y, float x) {
308+ auto d = CCKeyboardDispatcher::get ();
309+ auto ctrl = d->m_bControlPressed ;
310+ d->m_bControlPressed = ctrl || d->m_bCommandPressed ;
311+ EditorUI::scrollWheel (y, x);
312+ d->m_bControlPressed = ctrl;
313+ }
314+ #endif
328315};
329316
330317$execute {
@@ -496,14 +483,14 @@ struct $modify(EditorUI) {
496483 " robtop.geometry-dash/next-layer" ,
497484 " Next Layer" ,
498485 " Go to Next Editor Layer" ,
499- { Keybind::create (KEY_Right, Modifier::None) },
486+ { Keybind::create (KEY_Right, Modifier::None), GEODE_MACOS ( Keybind::create (KEY_ArrowRight, Modifier::None)) },
500487 Category::EDITOR_UI, true
501488 });
502489 BindManager::get ()->registerBindable ({
503490 " robtop.geometry-dash/prev-layer" ,
504491 " Previous Layer" ,
505492 " Go to Previous Editor Layer" ,
506- { Keybind::create (KEY_Left, Modifier::None) },
493+ { Keybind::create (KEY_Left, Modifier::None), GEODE_MACOS ( Keybind::create (KEY_ArrowLeft, Modifier::None)) },
507494 Category::EDITOR_UI, true
508495 });
509496 BindManager::get ()->registerBindable ({
0 commit comments