Skip to content

Commit

Permalink
Try to fix empty slot bouncing
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Sep 26, 2023
1 parent 01da871 commit 2f14406
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 71 deletions.
4 changes: 2 additions & 2 deletions Pkmds.Rcl/Components/BoxSlotComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@onclick="SetSelectedPokemon"
Width="68px"
Height="68px"
Class="d-flex align-items-center justify-center slot-fill"
Class="@SpriteHelper.GetSpriteCssClass(Pokemon)"
Style="@Style">
<img src="@(Pokemon is { Species: > 0 } ? SpriteHelper.GetPokemonSpriteFilename(Pokemon) : null)" />
<img class="pkm-sprite" src="@(Pokemon is { Species: > 0 } ? SpriteHelper.GetPokemonSpriteFilename(Pokemon) : null)" />
</MudPaper>
21 changes: 0 additions & 21 deletions Pkmds.Rcl/Components/BoxSlotComponent.razor.css

This file was deleted.

25 changes: 0 additions & 25 deletions Pkmds.Rcl/Components/PartyGrid.razor.css

This file was deleted.

4 changes: 2 additions & 2 deletions Pkmds.Rcl/Components/PartySlotComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@onclick="SetSelectedPokemon"
Width="68px"
Height="68px"
Class="d-flex align-items-center justify-center slot-fill"
Class="@SpriteHelper.GetSpriteCssClass(Pokemon)"
Style="@Style">
<img src="@(Pokemon is { Species: > 0 } ? SpriteHelper.GetPokemonSpriteFilename(Pokemon) : null)" />
<img class="pkm-sprite" src="@(Pokemon is { Species: > 0 } ? SpriteHelper.GetPokemonSpriteFilename(Pokemon) : null)" />
</MudPaper>
21 changes: 0 additions & 21 deletions Pkmds.Rcl/Components/PartySlotComponent.razor.css

This file was deleted.

3 changes: 3 additions & 0 deletions Pkmds.Rcl/SpriteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ public static string GetTypeSquareSpriteFileName(byte type) =>

public static string GetTypeWideSpriteFileName(byte type) =>
$"_content/Pkmds.Rcl/sprites/t/w/type_wide_{type:00}.png";

public static string GetSpriteCssClass(PKM? pkm) =>
$"d-flex align-items-center justify-center {(pkm is { Species: > 0 } ? "slot-fill" : string.Empty)}";
}
26 changes: 26 additions & 0 deletions Pkmds.Rcl/wwwroot/css/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
pkm-sprite {
max-width: 68px;
max-height: 56px;
align-self: center;
}

.slot-fill :hover {
transform-origin: center;
animation: bounce 500ms linear infinite;
border-radius: 6px;
}

.party-grid {
width: 462px; /* (68 + 4 + 5) * 30 */
}

@keyframes bounce {
0%, 100% {
transform: translateY(0);
}

50% {
transform: translateY(-5px);
}
}

.loading-progress {
position: relative;
display: block;
Expand Down

0 comments on commit 2f14406

Please sign in to comment.