Allow setting orientaiton in multi-PGN study chapter import

pull/8965/head
Benedikt Werner 2021-05-18 11:13:15 +02:00
parent 12d562e6f9
commit 273f758808
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
3 changed files with 5 additions and 7 deletions

View File

@ -225,7 +225,7 @@ private[study] object ChapterMaker {
variant: Option[String] = None,
fen: Option[FEN] = None,
pgn: Option[String] = None,
orientation: String = "white", // can be "auto"
orientation: String = "white", // can be "automatic"
mode: String = ChapterMaker.Mode.Normal.key,
initial: Boolean = false,
isDefaultName: Boolean = true

View File

@ -88,9 +88,7 @@ object StudyForm {
name = Chapter.Name((index == 0) ?? name),
variant = variantStr,
pgn = onePgn.some,
orientation =
if (pgns.sizeIs > 1) "auto"
else (orientationStr.flatMap(chess.Color.fromName) | chess.White).name,
orientation = orientationStr | "white",
mode = mode,
initial = initial && index == 0
)

View File

@ -317,9 +317,9 @@ export function view(ctrl: StudyChapterNewFormCtrl): VNode {
ctrl.vm.editor && ctrl.vm.editor.setOrientation((e.target as HTMLInputElement).value as Color);
}),
},
['white', 'black'].map(function (color) {
return option(color, currentChapter.setup.orientation, noarg(color));
})
(activeTab === 'pgn' ? ['automatic', 'white', 'black'] : ['white', 'black']).map(c =>
option(c, currentChapter.setup.orientation, noarg(c))
)
),
]),
]),