dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 12c21b9a954d88b67216eb3ef4c1c3902f5e59a0
parent 235173f59476923e5483c72d4cb9576c48fbbe61
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 15 Jun 2023 19:54:22 -0700

reduce css animations

Diffstat:
Mpkg/web/handlers/chess.go | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go @@ -875,8 +875,13 @@ func renderShowVisiblePieceInPosition(styles *StylesBuilder, animationIdx *int, piece := squareMap[newSq] // Get the piece currently on the new square according to game data styles.Appendf("#%s { display: block !important; "+ "background-image: url(/public/img/chess/"+piece.Color().String()+strings.ToUpper(piece.Type().String())+".png) !important; }", sqID) - animate(currentSq, newSq, sqID, piece) // Move piece from current square to the new square where we want it to be - piecesCache1[sqID] = newSq // Update cache of location of the piece + if currentSq != newSq { + animate(currentSq, newSq, sqID, piece) // Move piece from current square to the new square where we want it to be + } else { + x, y := squareCoord(currentSq, isFlipped) + styles.Appendf("#%s { left: calc(%d*12.5%%) !important; top: calc(%d*12.5%%) !important; }", sqID, x, y) + } + piecesCache1[sqID] = newSq // Update cache of location of the piece } }