Fix issues with moving cards jank.
This commit is contained in:
parent
409351aa70
commit
0ed1994a82
2 changed files with 12 additions and 12 deletions
5
TODO.md
5
TODO.md
|
|
@ -2,16 +2,17 @@
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] Ability to create, move, remove columns.
|
|
||||||
- [ ] Ability to create a project on the projects select page, including if TODO.md is empty.
|
- [ ] Ability to create a project on the projects select page, including if TODO.md is empty.
|
||||||
- [ ] Plus button in the columns to add a new item, with text input.
|
- [ ] Ability to create, move, remove columns.
|
||||||
- [ ] Minimize the number of times the user is asked for access. If possible ask for all the access required at one time.
|
- [ ] Minimize the number of times the user is asked for access. If possible ask for all the access required at one time.
|
||||||
|
- [ ] Plus button in the columns to add a new item, with text input.
|
||||||
|
|
||||||
## In progress
|
## In progress
|
||||||
|
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
|
|
||||||
|
- [x] Moving cards around janks the file.
|
||||||
- [x] When dragging between columns we should show the insertion point and insert the card at that point.
|
- [x] When dragging between columns we should show the insertion point and insert the card at that point.
|
||||||
- [x] Dropdown for setting the card as checked/unchecked.
|
- [x] Dropdown for setting the card as checked/unchecked.
|
||||||
- [x] Make it look more the makesprite/concrete.css theme.
|
- [x] Make it look more the makesprite/concrete.css theme.
|
||||||
|
|
|
||||||
19
index.html
19
index.html
|
|
@ -467,9 +467,11 @@
|
||||||
const section = state.sections[state.currentSectionIndex];
|
const section = state.sections[state.currentSectionIndex];
|
||||||
const targetColumn = section.columns[targetColumnIndex];
|
const targetColumn = section.columns[targetColumnIndex];
|
||||||
const targetColumnIsEmpty = targetColumn.cards.length === 0;
|
const targetColumnIsEmpty = targetColumn.cards.length === 0;
|
||||||
|
const isInsertingAtBottom = insertPosition === targetColumn.cards.length;
|
||||||
|
|
||||||
console.log('Before move, source line', fromLine, '=', lines[fromLine]);
|
console.log('Before move, source line', fromLine, '=', lines[fromLine]);
|
||||||
console.log('Target column is empty:', targetColumnIsEmpty);
|
console.log('Target column is empty:', targetColumnIsEmpty);
|
||||||
|
console.log('Inserting at bottom:', isInsertingAtBottom);
|
||||||
|
|
||||||
const [movedLine] = lines.splice(fromLine, 1);
|
const [movedLine] = lines.splice(fromLine, 1);
|
||||||
|
|
||||||
|
|
@ -499,11 +501,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.splice(actualInsertLine, 0, movedLine);
|
lines.splice(actualInsertLine, 0, movedLine);
|
||||||
|
|
||||||
const afterLine = actualInsertLine + 1;
|
|
||||||
if (afterLine >= lines.length || lines[afterLine].trim() !== '') {
|
|
||||||
lines.splice(afterLine, 0, '');
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Inserting at position', insertPosition);
|
console.log('Inserting at position', insertPosition);
|
||||||
const cardBefore = targetColumn.cards[insertPosition - 1];
|
const cardBefore = targetColumn.cards[insertPosition - 1];
|
||||||
|
|
@ -524,11 +521,13 @@
|
||||||
lines.splice(actualInsertLine, 0, movedLine);
|
lines.splice(actualInsertLine, 0, movedLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
const movedLineIndex = lines[actualInsertLine - 1] === movedLine ? actualInsertLine - 1 : actualInsertLine;
|
if (isInsertingAtBottom) {
|
||||||
const afterLine = movedLineIndex + 1;
|
const movedLineIndex = lines[actualInsertLine - 1] === movedLine ? actualInsertLine - 1 : actualInsertLine;
|
||||||
if (afterLine >= lines.length || lines[afterLine].trim() !== '') {
|
const afterLine = movedLineIndex + 1;
|
||||||
console.log('Ensuring blank line after moved item at line', afterLine);
|
if (afterLine >= lines.length || lines[afterLine].trim() !== '') {
|
||||||
lines.splice(afterLine, 0, '');
|
console.log('Inserting at bottom - ensuring blank line after moved item at line', afterLine);
|
||||||
|
lines.splice(afterLine, 0, '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue