commit 155eeb470e9c15bf92797a71f20f4fa1d7598778
parent 9b97c27126b475f7743633b76a5771601725429d
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sun, 11 Jun 2023 15:34:54 -0700
cleanup
Diffstat:
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -5185,22 +5185,17 @@ Loop:
continue
}
- i++
-
- //id1 := g.PiecesCache[payload.Move.S1()]
- x1 := int(payload.Move.S1().File())
- y1 := int(payload.Move.S1().Rank())
- x := int(payload.Move.S2().File())
- y := int(payload.Move.S2().Rank())
+ x1, y1 := int(payload.Move.S1().File()), int(payload.Move.S1().Rank())
+ x2, y2 := int(payload.Move.S2().File()), int(payload.Move.S2().Rank())
if isFlipped {
x1 = 7 - x1
- x = 7 - x
+ x2 = 7 - x2
} else {
y1 = 7 - y1
- y = 7 - y
+ y2 = 7 - y2
}
-
- _, _ = c.Response().Write([]byte(fmt.Sprintf(`<style>@keyframes move_anim_%d { from { left: calc(%d*12.5%%); top: calc(%d*12.5%%); } to { left: calc(%d*12.5%%); top: calc(%d*12.5%%); } }</style>`, i, x1, y1, x, y)))
+ i++
+ _, _ = c.Response().Write([]byte(fmt.Sprintf(`<style>@keyframes move_anim_%d { from { left: calc(%d*12.5%%); top: calc(%d*12.5%%); } to { left: calc(%d*12.5%%); top: calc(%d*12.5%%); } }</style>`, i, x1, y1, x2, y2)))
_, _ = c.Response().Write([]byte(fmt.Sprintf(`<style>#%s { animation-name: move_anim_%d; animation-duration: 400ms; animation-fill-mode: forwards; }</style>`, payload.IDStr1, i)))
if payload.IDStr2 != "" {
_, _ = c.Response().Write([]byte(`<style>#` + payload.IDStr2 + ` { display: none; }</style>`))
@@ -5266,14 +5261,6 @@ Loop:
_, _ = c.Response().Write([]byte(`<style>#img_60 { background-color: rgba(255, 0, 0, 0.4) !important; }</style>`))
}
- //var card1 string
- //if isSpectator {
- // card1 = g.DrawSpectatorCard(isFlipped)
- //} else {
- // card1 = g.DrawPlayerCard(isFlipped, isYourTurnFn())
- //}
- //_, _ = c.Response().Write([]byte(fmt.Sprintf(`<style>#div_%d { display: none; }</style>`, i-1)))
- //_, _ = c.Response().Write([]byte(fmt.Sprintf(`<div id="div_%d">%s</div>`, i, card1)))
c.Response().Flush()
}
return nil