Skip to content

Commit

Permalink
Merge pull request #137 from 24ik/gui
Browse files Browse the repository at this point in the history
Gui
  • Loading branch information
24ik authored Sep 29, 2024
2 parents 3c3edf9 + 9b139f7 commit 717f11f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 53 deletions.
2 changes: 1 addition & 1 deletion pon2.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.20.0"
version = "0.20.1"
author = "Keisuke Izumiya"
description = "Application for Puyo Puyo and Nazo Puyo"
license = "Apache-2.0"
Expand Down
5 changes: 1 addition & 4 deletions src/pon2pkg/app/simulator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ func `mode=`*(mSelf; mode: SimulatorMode) {.inline.} =
if mode == mSelf.mode:
return

if mSelf.mode in {Play, View}:
return

mSelf.nazoPuyoWrap = mSelf.nazoPuyoWrapBeforeMoves
mSelf.mode = mode
mSelf.state = Stable
Expand Down Expand Up @@ -841,7 +838,7 @@ func operate*(mSelf; event: KeyEvent): bool {.discardable.} =
elif event in
[initKeyEvent("Digit2", shift = true), initKeyEvent("KeyW", shift = true)]:
mSelf.backward(toStable = false)
elif event == initKeyEvent("Digit3"):
elif event in [initKeyEvent("Digit3"), initKeyEvent("KeyS")]:
mSelf.forward(replay = true)
elif event == initKeyEvent("Digit1"):
mSelf.reset
Expand Down
95 changes: 48 additions & 47 deletions src/pon2pkg/private/app/simulator/web/share.nim
Original file line number Diff line number Diff line change
Expand Up @@ -70,53 +70,54 @@ proc initShareNode*(simulator: ref Simulator, id = ""): VNode {.inline.} =
editorPosUrlCopyButtonId = &"{EditorPosUrlCopyButtonIdPrefix}{id}"

result = buildHtml(tdiv):
tdiv(class = "block"):
span(class = "icon"):
italic(class = "fa-brands fa-x-twitter")
span:
text "でシェア"
tdiv(class = "buttons"):
a(
class = "button is-size-7",
target = "_blank",
rel = "noopener noreferrer",
href = kstring $simulator[].toXlink(withPositions = false),
):
text "操作無"
a(
class = "button is-size-7",
target = "_blank",
rel = "noopener noreferrer",
href = kstring $simulator[].toXlink(withPositions = true),
):
text "操作有"
tdiv(class = "block"):
text "画像ダウンロード"
tdiv(class = "buttons"):
button(class = "button is-size-7", onclick = initDownloadHandler(id, false)):
text "操作無"
button(class = "button is-size-7", onclick = initDownloadHandler(id, true)):
text "操作有"
tdiv(class = "block"):
text "URLコピー"
tdiv(class = "buttons"):
button(
id = urlCopyButtonId.kstring,
class = "button is-size-7",
onclick = initCopyButtonHandler(
() => $simulator.toPlayUri(withPositions = false), urlCopyButtonId
),
):
text "操作無"
button(
id = posUrlCopyButtonId.kstring,
class = "button is-size-7",
onclick = initCopyButtonHandler(
() => $simulator.toPlayUri(withPositions = true), posUrlCopyButtonId
),
):
text "操作有"
if simulator[].mode in {PlayEditor, Edit}:
if simulator[].mode != View:
tdiv(class = "block"):
span(class = "icon"):
italic(class = "fa-brands fa-x-twitter")
span:
text "でシェア"
tdiv(class = "buttons"):
a(
class = "button is-size-7",
target = "_blank",
rel = "noopener noreferrer",
href = kstring $simulator[].toXlink(withPositions = false),
):
text "操作無"
a(
class = "button is-size-7",
target = "_blank",
rel = "noopener noreferrer",
href = kstring $simulator[].toXlink(withPositions = true),
):
text "操作有"
tdiv(class = "block"):
text "画像ダウンロード"
tdiv(class = "buttons"):
button(class = "button is-size-7", onclick = initDownloadHandler(id, false)):
text "操作無"
button(class = "button is-size-7", onclick = initDownloadHandler(id, true)):
text "操作有"
tdiv(class = "block"):
text "URLコピー"
tdiv(class = "buttons"):
button(
id = urlCopyButtonId.kstring,
class = "button is-size-7",
onclick = initCopyButtonHandler(
() => $simulator.toPlayUri(withPositions = false), urlCopyButtonId
),
):
text "操作無"
button(
id = posUrlCopyButtonId.kstring,
class = "button is-size-7",
onclick = initCopyButtonHandler(
() => $simulator.toPlayUri(withPositions = true), posUrlCopyButtonId
),
):
text "操作有"
if simulator[].mode != SimulatorMode.Play:
tdiv(class = "block"):
text "編集者URLコピー"
tdiv(class = "buttons"):
Expand Down
2 changes: 1 addition & 1 deletion tests/simulator/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ proc main*() =
check simulator.mode == Play

simulator.mode = View
check simulator.mode == Play
check simulator.mode == View

# ------------------------------------------------
# Property - Score
Expand Down

0 comments on commit 717f11f

Please sign in to comment.