Skip to content
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.

Commit

Permalink
用 Ctrl + B 激活复制后不用退出,就可以按 Ctrl + F 搜索(#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangshimin committed Jul 22, 2022
1 parent ca36b1e commit bbc0ae3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/kotlin/components/TypingWord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ fun TypingWord(
/** 是否正在播放单词发音 */
var isPlayingAudio by remember { mutableStateOf(false) }

/** 打开搜索 **/
val openSearch:() -> Unit = {
searching = true
}

/**
* 用快捷键播放视频时被调用的回调函数
* @param playTriple 视频播放参数,Caption 表示要播放的字幕,String 表示视频的地址,Int 表示字幕的轨道 ID。
Expand Down Expand Up @@ -1060,7 +1065,8 @@ fun TypingWord(
modifier = captionsModifier,
focusRequesterList = listOf(focusRequester1,focusRequester2,focusRequester3),
jumpToWord = {jumpToWord()},
externalVisible = typingWord.externalSubtitlesVisible
externalVisible = typingWord.externalSubtitlesVisible,
openSearch = {openSearch()}
)
if (isPlaying) Spacer(
Modifier.height((videoSize.height).dp).width(videoSize.width.dp)
Expand Down Expand Up @@ -1479,6 +1485,7 @@ fun Captions(
focusRequesterList:List<FocusRequester>,
jumpToWord: () -> Unit,
externalVisible:Boolean,
openSearch: () -> Unit,
) {
if (captionsVisible) {
val horizontalArrangement = if (isPlaying) Arrangement.Center else Arrangement.Start
Expand Down Expand Up @@ -1587,6 +1594,7 @@ fun Captions(
selectable = selectable,
setSelectable = {selectable = it},
isPathWrong = isPathWrong,
openSearch = {openSearch()}
)
}

Expand Down Expand Up @@ -1674,6 +1682,7 @@ fun Caption(
selectable:Boolean,
setSelectable:(Boolean) -> Unit,
isPathWrong:Boolean,
openSearch: () -> Unit,
) {
val scope = rememberCoroutineScope()
Column(modifier = Modifier.width(IntrinsicSize.Max)) {
Expand Down Expand Up @@ -1771,6 +1780,9 @@ fun Caption(
if (it.isCtrlPressed && it.key == Key.B && it.type == KeyEventType.KeyUp) {
scope.launch { setSelectable(!selectable) }
true
}else if (it.isCtrlPressed && it.key == Key.F && it.type == KeyEventType.KeyUp) {
scope.launch { openSearch() }
true
} else false
}
)
Expand Down

0 comments on commit bbc0ae3

Please sign in to comment.