mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(reorder-group): dragging reorder item to bottom no longer gives out of bounds index (#23797)
resolves #23796
This commit is contained in:
@@ -245,17 +245,16 @@ export class ReorderGroup implements ComponentInterface {
|
||||
|
||||
private itemIndexForTop(deltaY: number): number {
|
||||
const heights = this.cachedHeights;
|
||||
let i = 0;
|
||||
|
||||
// TODO: since heights is a sorted array of integers, we can do
|
||||
// speed up the search using binary search. Remember that linear-search is still
|
||||
// faster than binary-search for small arrays (<64) due CPU branch misprediction.
|
||||
for (i = 0; i < heights.length; i++) {
|
||||
for (let i = 0; i < heights.length; i++) {
|
||||
if (heights[i] > deltaY) {
|
||||
break;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
return heights.length - 1;
|
||||
}
|
||||
|
||||
/********* DOM WRITE ********* */
|
||||
|
||||
Reference in New Issue
Block a user