INNER CODE UNIT · JavaScript

low

sirius-ms/sirius · lcms2/viewer/viewer.js:32

            low = mid + 1; // Target is in the right half
        } else {
            high = mid - 1; // Target is in the left half
        }

        // Update the closest index if needed
        if (closestIndex === -1 || Math.abs(functor(arr[mid]) - target) < Math.abs(functor(arr[closestIndex]) - target)) {
            closestIndex = mid;
        }
    }

    return closestIndex; // Target not found, return the closest index
}
function updateSlider(evt) {
  let value = d3.select("#mzslider").node().value;
  d3.select("#mznum").node().value = value;
  let index = binarySearchClosest(document.lcdata, parseFloat(value), (x)=>x.mz);
  document.currentIndex = index;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…