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: SequencerPitchをリファクタ #2510

Merged
merged 7 commits into from
Jan 31, 2025

Conversation

sigprogramming
Copy link
Contributor

@sigprogramming sigprogramming commented Jan 28, 2025

内容

SequencerPitchのリファクタリングです。

主に以下を行います。

  • templateタグ内でcanvas要素を定義して、vueのrefで参照する形に変更
  • PitchLineをクラス化し、updateLineStripsの処理をPitchLineクラスに移動
  • PitchDataを{ ticksArray: number[]; data: number[] }から{ baseX: number; baseY: number }[]に変更
  • toPitchDatasplitPitchDatasetPitchDataToPitchLineの処理をtoPitchDataMapにまとめる

その他

@voicevox-preview-pages
Copy link

voicevox-preview-pages bot commented Jan 28, 2025

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:b5f821c

@sigprogramming sigprogramming marked this pull request as ready for review January 29, 2025 13:34
@sigprogramming sigprogramming requested a review from a team as a code owner January 29, 2025 13:34
@sigprogramming sigprogramming requested review from Hiroshiba and removed request for a team January 29, 2025 13:34
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!

1点だけこちらで変更させていただこうと思います! 🙇


ちょっとずうずうしいお願いなのですが、もしできれば今度からコードの移動とコードの変更はコミットを分けていただけるとありがたいです・・・!
移動と変更を同時にすると、PR内でbefore/afterでコードの変更箇所がわからなくなってしまい。。(gitが差分として見つけられない)
移動と変更が別PRだと最高ですが、移動だけ最初にコミットとかでもかなり助かります 🙏

(ちなみにこれはGoogleのベストプラクティス似たことが書いてたりします。)
https://google-engineering-practices.translation.shuuji3.xyz/review/developer/small-cls.html

src/sing/graphics/pitchLine.ts Outdated Show resolved Hide resolved
src/sing/graphics/pitchLine.ts Outdated Show resolved Hide resolved
@sigprogramming
Copy link
Contributor Author

@Hiroshiba
レビューしにくい差分で申し訳ないです…(一気にやろうとしてこうなりました…)
次回から移動と変更を分けるようにします…!

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!

いろいろ注文付けてしまってすみません。。 🙇
リファクタリングはウェルカムです、ぜひぜひ!!!


ちょこっと思ったのですが、たぶん今回のリファクタリングは将来描画を自前で行う(今は一部VueやHTMLを使ってる)のも見据えての感じなのかなと思います。
HTMLをあまり使わないのは賛成よりですが、レンダリングに関してはVueのreactive(refとかcomputedとかwatchとか)ドリブンでも良いのかもと少し思いました!
毎フレーム描画だとわりと重い処理だと思うのと、Vueのreactiveの機構が特に計算負荷にならなそうだなーと思い。

・・・ここまで書いて気づいたのですが、このプルリクエストはまさに「値が変わったらレンダリングする」になってますね!!!!!

@Hiroshiba Hiroshiba enabled auto-merge January 31, 2025 16:19
@Hiroshiba Hiroshiba added this pull request to the merge queue Jan 31, 2025
Merged via the queue into VOICEVOX:main with commit f6bdb13 Jan 31, 2025
11 checks passed
@sigprogramming sigprogramming deleted the refactor_sequencer_pitch branch February 1, 2025 14:40
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.

2 participants