-
Notifications
You must be signed in to change notification settings - Fork 311
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
feat: ソング:音素タイミングの表示エリアを追加 #2472
feat: ソング:音素タイミングの表示エリアを追加 #2472
Conversation
🚀 プレビュー用ページを作成しました 🚀 更新時点でのコミットハッシュ: |
@@ -27,6 +27,7 @@ const meta: Meta<typeof Presentation> = { | |||
offset: 0, | |||
numMeasures: 32, | |||
sequencerSnapType: 16, | |||
uiLocked: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storybookで警告が出ていたので修正しました。
設定(開発時のみ機能)を追加したことでマイグレーションのテストが通らなくなりましたが、マイグレーションをどう実装したら良いか分かりません… |
// 画面右下に固定表示 | ||
// 幅固定、高さ可変、画像のアスペクト比を保持、wrapのwidthに合わせてheightを調整 | ||
// bottom位置はスクロールバーの上に表示 | ||
// 幅固定、高さ可変、画像のアスペクト比を保持、heightを調整 | ||
.character-portrait-wrap { | ||
opacity: 0.55; | ||
overflow: visible; | ||
contain: layout; | ||
position: relative; | ||
height: max(100%, $portrait-min-height); | ||
margin-right: $right-margin; | ||
overflow: hidden; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-end; | ||
align-items: flex-end; | ||
pointer-events: none; | ||
position: fixed; | ||
display: grid; | ||
place-items: end; | ||
bottom: 0; | ||
right: $right-margin; | ||
} | ||
|
||
.spacer { | ||
flex: 0 1 $spacer-height; | ||
width: 1px; | ||
} | ||
|
||
.character-portrait { | ||
width: auto; | ||
height: $portrait-max-height; | ||
min-height: $portrait-min-height; | ||
flex: 1 0; | ||
min-width: $portrait-min-width; | ||
max-width: $portrait-max-width; | ||
overflow: visible; | ||
min-height: $portrait-min-height; | ||
max-height: $portrait-max-height; | ||
opacity: 0.55; | ||
backface-visibility: hidden; | ||
object-fit: cover; | ||
object-position: top center; | ||
} | ||
|
||
// ポートレートサイズが画面サイズを超えた場合、ヘッダーを考慮してポートレートを上部基準で表示させる | ||
// ヘッダー高さ120px+ポートレート高さ500pxだとする | ||
@media (max-height: #{calc(#{$portrait-min-height} + #{$header-margin})}) { | ||
.character-portrait-wrap { | ||
top: $header-margin; // ヘッダーの高さより下に位置させる | ||
bottom: auto; | ||
height: calc(100vh - #{$header-margin}); | ||
place-items: start end; | ||
} | ||
object-fit: contain; | ||
object-position: bottom center; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romot-co
できるだけ以前と同じ挙動になるようにしましたが、正しく実装できているか自信が無いので、スタイル周り、ご確認いただけると助かります…!
(contain: layout;
など、効いていなさそうなプロパティを消しましたが、必要なものも消しているかもしれません…)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sigprogramming
こちら確認いたします!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
メモ書きです…!
contain: layout
はfixed
以外で実装しようとした時の名残なので消しても大丈夫そうです(スクロール時のパフォーマンス上がることがあるので残しておいても問題ないはず)- コンテナ要素に対して
position: sticky
+子にmax-width
指定が一番楽そう
.portrait-wrap {
position: sticky;
bottom: 0;
right: 0;
width: 320px; /* 横長・縦長対応がきつそう... */
}
.portrait-image {
width: 100%;
height: auto;
max-height: 300px /* 仮 */
object-fit: contain;
position: absolute; /* wrapに対し固定 */
bottom: auto;
bottom: 0;
}
// あとはContainer Queryなど?
ほか気になっているやつ:
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sigprogramming
こちら以下で修正いたしました…!挙動他問題や影響ありましたらおしらせください!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romot-co
ありがとうございます!!とても助かります…!
挙動を確認してみたのですが、今のmainブランチではシーケンサーのheightがある程度大きくなると立ち絵も拡大されるようになっていて、 6c942e9 では拡大されなくなっているかもです。ここの挙動、どうしましょう…
また、position: sticky
ありとposition: sticky
なしの挙動の差があまり分かりませんでした…
調べてみたところ、position: sticky
になっている要素がスティッキーアイテムで、その親がスティッキーコンテナになるようです。
https://coliss.com/articles/build-websites/operation/css/css-position-sticky-how-it-really-works.html
なので、 6c942e9 の実装だとcharacter-portrait-wrap
がスティッキーアイテム、score-sequencer
がスティッキーコンテナになりますが、character-portrait-wrap
はグリッドアイテムでもあるので、もしかしたら上手く機能していないかも…?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっと自分も試してみたんですが、原理は全く分かりませんがなんかこれでうまいことできた気がします!!
PRも作ってみました! sigprogramming#4
<style scoped lang="scss">
@use "@/styles/variables" as vars;
@use "@/styles/colors" as colors;
// 表示変数
$portrait-min-height: 500px;
// 画面右下に固定表示
// 幅固定、高さ可変、画像のアスペクト比を保持、heightを調整
.character-portrait-wrap {
height: 100%;
display: flex;
flex-direction: column;
margin-left: auto;
overflow: hidden;
}
// 通常は下部基準だが、親要素が最小高さより小さい場合は上部基準とし頭を残して足から隠れさせる
.character-portrait {
display: block;
margin-top: auto;
min-height: max(75%, $portrait-min-height);
opacity: 0.55;
backface-visibility: hidden;
object-fit: contain;
}
</style>
ちなみにChatGPTに聞きました。o1君、結構CSSの強い味方かもしれない。
https://chatgpt.com/share/678d25ad-68f0-8008-b197-0c1b7da2b59b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hiroshiba
こちら確認しました!
簡潔な手法でだいぶベストに思えます…!
o1すごい…!
$portrait-min-height: 500px; // 最小高さ
$portrait-max-height: 60%; // 最大高さ 75%だと画面によってはでっかすぎるので60%ぐらいがよさそう
// 以下変更なし・動作のコメントだけ付与
// 画面右下に固定表示
// 幅固定、高さ可変、画像のアスペクト比を保持、heightを調整
.character-portrait-wrap {
display: flex;
flex-direction: column;
// コンテナ要素に対し高さを100%にし、固定右寄せ
height: 100%;
margin-left: auto;
// 内部スクロールを行わせない
overflow: hidden;
}
// 通常は最下部に表示し、親要素が最小高さより小さい場合は上部基準とし頭を残して足から隠れさせる
.character-portrait {
display: block;
// wrapに対し下寄せ
margin-top: auto;
// 最小高さと最大高さのうち大きい方を適用
min-height: max($portrait-min-height, $portrait-max-height);
// アスペクト比を保持
object-fit: contain;
// 透明度
opacity: 0.55;
// 以下なくてもいいけどあるとGPU効きがち
backface-visibility: hidden;
transform: translateZ(0);
}
+たぶん
ポートレート幅 > 親のQSplitter幅の場合に
にスクロールバーが二重に出るかもなので
<QSplitter
...
style="overflow: hidden" // スクロールさせない
>
みたいにすれば完了に思えます!
あとで修正PR送ります…!
これはunitテストのsnapshotを更新すれば良さそうです! どういうタイミングで何のスナップショットを更新すれば良いのかわかりづらい・・・というよりわからないですね・・・・・・。 |
@Hiroshiba |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビューしました!
spliterを導入して、各ペインでdivが一枚ずつ挟まってる構造、良さそう!
かなりいろいろ試行錯誤があってこのCSSにたどり着いたんだと思います、ありがとうございます!!!
DummyGridを用意してスクロールイベントを同期させるの、複雑性が上がっているのでなんとかできないか調べてたのですが、親にcontain: layout
を指定すればfixed
の固定位置がその親依存になるっぽいです!!!!!
https://developer.mozilla.org/ja/docs/Web/CSS/contain#%E3%83%AC%E3%82%A4%E3%82%A2%E3%82%A6%E3%83%88%E6%8B%98%E6%9D%9F
実際.score-sequencer
の中にcontain: layout;
入れたら、元のコードでも大部分動きそうでした!!
たぶんDummyGridをなくせて、fixedに戻せて、立ち絵・グリッド・ガイドラインももとに戻せる気がします。
(こっちのほうが構造的に正しいので可能ならこうしておくと機能継ぎ足しが簡単そう)
立ち絵のメディアクエリだけはどうしてもこのPRのように別解を探す必要がありそうな気がしました!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(メモ)
間違い探しレベルですが、右下の縮小スライダーの位置が微妙に変わってますね!
問題なさそう感!
@Hiroshiba
知りませんでした…!ありがとうございます!
構造的に正しいというのはDummyGridをなくせるからでしょうか? |
ですです! 整理すると、今のPRのコードはこうなっていて、
元のコードはこんな感じかなと。
まあcanvasとかに置き換えるなら今はどちらでも良いかもなのですが、こっちの方はDummyがないのもあって全体が把握しやすいかもです! ただdisplay: gridで同じ場所に重ね起きするこのPRの実装だと、2つのエリアに貫通するUIとかを作りやすいので、お互い一長一短かもなのですが 😇 |
ダミーグリッドを使うかどうかもう少し考えてみました! コードがコピペになってしまうのはちょっと避けたいので、provide/inject形式にだけはしておきたいかもです! |
Co-authored-by: Hiroshiba <[email protected]>
Co-authored-by: Hiroshiba <[email protected]>
...クリーンショット.spec.mts-snapshots/components-sing-sequencergrid--default-light-storybook-win32.png
Outdated
Show resolved
Hide resolved
Co-authored-by: Hiroshiba <[email protected]>
Co-authored-by: Hiroshiba <[email protected]>
Co-authored-by: Hiroshiba <[email protected]>
ちょっと調整を行います! |
あ、スクショがコンフリクトしていそうです! (コンフリクト解消すると、プレビュー用のページやStorybookの確認がpreview-pages通してブラウザで可能になるので便利です) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ほぼLGTMです!!!あと少し!!
...クリーンショット.spec.mts-snapshots/components-sing-sequencergrid--default-light-storybook-win32.png
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
さらにスクショの更新するのは不要でした・・・! 🙏
立ち絵に関しても実際にいろんなサイズにして確認してみました。多分大丈夫なはず!!
@romot-co さんすみません、たぶん大丈夫だと思うのでマージさせていただきます! 🙏
内容
音素タイミングを表示するエリア(パラメーターパネル)を追加します。
(エリアの追加のみで、音素タイミングの表示は未実装)
ピアノロールの下に表示が良いかなと思っていて、ひとまずそれで実装しています。
パラメーターパネルを表示するかどうかの設定は開発時のみ機能にしています。
また、
position: fixed
で実装されているコンポーネント(CharacterPortrait
とズームのスライダー)がシーケンサーにあったので、QSplitter
を使ったときに正しく表示されるようにposition: absolute
等にして調整を行いました。具体的には以下を行いました。
CharacterPortrait
がsequencerBody
の中にありposition: fixed
以外にできなかったので、以下を行ったSequencerGrid
をsequencerBody
の外に出して、スクロール位置をoffsetX, offsetY
に渡す形に変更sequencerBody
の中にSequencerDummyGrid
を置いて正しいスクロール範囲になるようにしたCharacterPortrait
をsequencerBody
の外に出して、正しく表示できるように調整flex
プロパティとspacer
要素を使用)position: absolute
にしたついでに以下も行いました。
sequencer-guideline
もsequencerBody
の外に出した関連 Issue
スクリーンショット・動画など
その他