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

複数選択:複数削除を追加 #1656

Merged
merged 7 commits into from
Nov 23, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/components/AudioCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,7 @@ const removeCell = async () => {
isMultiSelectEnabled.value &&
store.getters.SELECTED_AUDIO_KEYS.includes(props.audioKey)
) {
audioKeysToDelete = store.state.audioKeys.filter((audioKey) =>
store.getters.SELECTED_AUDIO_KEYS.includes(audioKey)
);
audioKeysToDelete = store.getters.SELECTED_AUDIO_KEYS;
} else {
audioKeysToDelete = [props.audioKey];
}
Expand All @@ -455,19 +453,21 @@ const removeCell = async () => {
willRemove.value = true;

if (audioKeysToDelete.includes(props.audioKey)) {
const firstAudioKey = audioKeysToDelete[0];
const firstIndex = audioKeys.value.indexOf(
isMultiSelectEnabled.value ? firstAudioKey : props.audioKey
);
// 選択するAudioKeyを決定する。
// - 削除ボタンが押されたAudioCellから開始
// - 残るAudioCellを上方向に探す
// - 上方向になかったら下方向に探す
// - なかったらエラー(Unreachable)
const audioKeyIndex = audioKeys.value.indexOf(props.audioKey);
let willNextFocusIndex = -1;
for (let i = firstIndex; i >= 0; i--) {
for (let i = audioKeyIndex; i >= 0; i--) {
if (!audioKeysToDelete.includes(audioKeys.value[i])) {
willNextFocusIndex = i;
break;
}
}
if (willNextFocusIndex === -1) {
for (let i = firstIndex; i < audioKeys.value.length; i++) {
for (let i = audioKeyIndex; i < audioKeys.value.length; i++) {
if (!audioKeysToDelete.includes(audioKeys.value[i])) {
willNextFocusIndex = i;
break;
Expand Down