Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: 再生中のアクセント句の見た目を強調する処理を改善 #1526

Merged

Conversation

thiramisu
Copy link
Contributor

@thiramisu thiramisu commented Aug 27, 2023

内容

具体的には以下の点を変更しました。

  • setIntervalrequestAnimationFrameに変更
  • currentTime !== undefineの判定をforループの外に出す
  • forループをfindIndexへ変更
  • エラー分岐を詳細にする
  • [追記] 必要時(activePoint.value変更時)のみscrollToActivePointが実行されるように変更

ユーザー視点での変更はありません。

関連 Issue

その他

Window.requestAnimationFrame() - Web API | MDN
次フレームの直前に実行される処理を指定できるメソッドです。

@thiramisu thiramisu requested a review from a team as a code owner August 27, 2023 12:46
@thiramisu thiramisu requested review from y-chan and removed request for a team August 27, 2023 12:46
@thiramisu
Copy link
Contributor Author

眺めていたら処理の重さが未知数のscrollToActivePointが毎フレーム実行されるのがちょっと気になったので、必要時のみ実行されるように変更しました。

Copy link
Member

@y-chan y-chan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMです!
setIntervalよりもきれいになってより賢い実装になったと思います!

@Hiroshiba Hiroshiba merged commit 31dc0e5 into VOICEVOX:main Sep 3, 2023
@thiramisu thiramisu deleted the refactor-accent-phrase-highlighting branch September 3, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants