Skip to content

Commit

Permalink
fix "can't select after deleting" bug and use IsKeyPressed for all vi…
Browse files Browse the repository at this point in the history
…ewport Hotkeys
  • Loading branch information
jupahe64 committed Nov 20, 2023
1 parent b503b14 commit a1e62fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Fushigi/ui/widgets/CourseScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,10 @@ private void LinkDeletionCheck()
{
if (activeViewport.mEditContext.IsAnySelected<CourseActor>())
{
Console.WriteLine("Switching state to EditorState.DeletingActor");
activeViewport.mEditContext.DeleteSelectedActors();
activeViewport.mEditorState = LevelViewport.EditorState.Selecting;
}
Console.WriteLine("Switching state to EditorState.Selecting");
activeViewport.mEditorState = LevelViewport.EditorState.Selecting;
return;
}

Expand Down
12 changes: 6 additions & 6 deletions Fushigi/ui/widgets/LevelViewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ public void Draw(Vector2 size, double deltaSeconds, IDictionary<string, bool> la
}
}

if (ImGui.IsKeyDown(ImGuiKey.Delete))
if (ImGui.IsKeyPressed(ImGuiKey.Delete))
{
mEditorState = EditorState.DeleteActorLinkCheck;
}

if (ImGui.IsKeyDown(ImGuiKey.Escape))
if (ImGui.IsKeyPressed(ImGuiKey.Escape))
{
mEditContext.DeselectAll();
mSelectedPoint = null;
Expand All @@ -458,7 +458,7 @@ public void Draw(Vector2 size, double deltaSeconds, IDictionary<string, bool> la
{
ImGui.SetTooltip($"Placing actor {mActorToAdd} -- Hold SHIFT to place multiple, ESCAPE to cancel.");

if (ImGui.IsKeyDown(ImGuiKey.Escape))
if (ImGui.IsKeyPressed(ImGuiKey.Escape))
{
mEditorState = EditorState.Selecting;
}
Expand Down Expand Up @@ -511,7 +511,7 @@ Click on any actor to delete it.
Hold SHIFT to delete multiple actors, ESCAPE to cancel.
""");

if (ImGui.IsKeyDown(ImGuiKey.Escape))
if (ImGui.IsKeyPressed(ImGuiKey.Escape))
{
mEditorState = EditorState.Selecting;
}
Expand All @@ -538,7 +538,7 @@ Click on any actor to delete it.
ImGui.SetWindowFocus();
}

if (ImGui.IsKeyDown(ImGuiKey.Escape))
if (ImGui.IsKeyPressed(ImGuiKey.Escape))
{
mEditorState = EditorState.Selecting;
}
Expand Down Expand Up @@ -839,7 +839,7 @@ Vector2[] GetPoints()
}

//Delete selected
if (selectedPoint != null && ImGui.IsKeyDown(ImGuiKey.Delete))
if (selectedPoint != null && ImGui.IsKeyPressed(ImGuiKey.Delete))
{
rail.mPoints.Remove(selectedPoint);
}
Expand Down

0 comments on commit a1e62fb

Please sign in to comment.