Skip to content

Commit 271c764

Browse files
authored
Add missing keybind to gizmos example (#22178)
# Objective - I noticed that the example 2d_gizmos said about pressing J or K to cycle between joints, but letter K wasn't working, same with letter I ## Solution - Just add the keybinds and make them cycle in reverse. Other possible solution would be removing the mention to such letters entirely, but the example looks cooler with those.
1 parent 342c359 commit 271c764

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

examples/gizmos/2d_gizmos.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ fn update_config(
149149
_ => GizmoLineStyle::Solid,
150150
};
151151
}
152+
if keyboard.just_pressed(KeyCode::KeyI) {
153+
config.line.style = match config.line.style {
154+
GizmoLineStyle::Solid => GizmoLineStyle::Dashed {
155+
gap_scale: 3.0,
156+
line_scale: 5.0,
157+
},
158+
GizmoLineStyle::Dotted => GizmoLineStyle::Solid,
159+
_ => GizmoLineStyle::Dotted,
160+
};
161+
}
152162
if keyboard.just_pressed(KeyCode::KeyJ) {
153163
config.line.joints = match config.line.joints {
154164
GizmoLineJoint::Bevel => GizmoLineJoint::Miter,
@@ -158,6 +168,15 @@ fn update_config(
158168
};
159169
}
160170

171+
if keyboard.just_pressed(KeyCode::KeyK) {
172+
config.line.joints = match config.line.joints {
173+
GizmoLineJoint::Bevel => GizmoLineJoint::None,
174+
GizmoLineJoint::Miter => GizmoLineJoint::Bevel,
175+
GizmoLineJoint::Round(_) => GizmoLineJoint::Miter,
176+
GizmoLineJoint::None => GizmoLineJoint::Round(4),
177+
};
178+
}
179+
161180
let (my_config, _) = config_store.config_mut::<MyRoundGizmos>();
162181
if keyboard.pressed(KeyCode::ArrowUp) {
163182
my_config.line.width += 5. * time.delta_secs();

0 commit comments

Comments
 (0)