Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function lod (lox, loy, hix, hiy, maxLevel) {
let ranges = []
for (let level = 0; level < maxLevel; level++) {
let levelGroups = groups[level]
let from = offsets[level][0]
let levelGroupStart = group(lox, loy, level)
let levelGroupEnd = group(hix, hiy, level)
// FIXME: utilize sublevels to speed up search range here
let startOffset = search.ge(levelGroups, levelGroupStart)
let endOffset = search.gt(levelGroups, levelGroupEnd, startOffset, levelGroups.length - 1)
ranges[level] = [startOffset + from, endOffset + from]
}
return ranges
}
});
var sortedHigh = this._orderedRanges.map(
function (r) {
return { v: r.max, b: r.isMaxInclusive };
});
// this for loop doesn't invoke any async callback
for (var i = 0; i < providedQueryRanges.length; i++) {
var queryRange = providedQueryRanges[i];
if (queryRange.isEmpty()) {
continue;
}
var minIndex = bs.le(sortedLow, { v: queryRange.min, b: !queryRange.isMinInclusive }, this._vbCompareFunction);
assert.ok(minIndex >= 0, "error in collection routing map, queried value is less than the start range.");
var maxIndex = bs.ge(sortedHigh, { v: queryRange.max, b: queryRange.isMaxInclusive }, this._vbCompareFunction);
assert.ok(maxIndex < sortedHigh.length, "error in collection routing map, queried value is greater than the end range.");
// the for loop doesn't invoke any async callback
for (var j = minIndex; j < maxIndex + 1; j++) {
if (queryRange.overlaps(this._orderedRanges[j])) {
minToPartitionRange[this._orderedPartitionKeyRanges[j][_PartitionKeyRange.MinInclusive]] = this._orderedPartitionKeyRanges[j];
}
}
}
var overlappingPartitionKeyRanges = _.values(minToPartitionRange);
var getKey = function (r) {
return r[_PartitionKeyRange.MinInclusive];
};
return _.sortBy(overlappingPartitionKeyRanges, getKey);
updateObject: function(name, obj) {
var oldindex = -1;
if (this.map.hasOwnProperty(name)) {
var oldobj = this.map[name];
// Already up to date: nothing to do!
if (obj !== null && oldobj.mtime == obj.mtime) {
return;
}
oldindex = lb(this.list, oldobj, byMtime);
if (obj === null) {
// Remove the item at its old position
this.list.splice(oldindex, 1);
delete this.map[name];
return;
}
}
if (obj == null) {
// If the file doesn't exist, there is nothing to insert.
return;
}
// Insert the item at its new position
this.map[name] = obj;
var index = lb(this.list, obj, byMtime);
if (oldindex == -1) {
// It's a new item: insert it.
}
oldindex = lb(this.list, oldobj, byMtime);
if (obj === null) {
// Remove the item at its old position
this.list.splice(oldindex, 1);
delete this.map[name];
return;
}
}
if (obj == null) {
// If the file doesn't exist, there is nothing to insert.
return;
}
// Insert the item at its new position
this.map[name] = obj;
var index = lb(this.list, obj, byMtime);
if (oldindex == -1) {
// It's a new item: insert it.
this.list.splice(index, 0, obj);
} else {
// It's moving in the list: shift the old items over, then set it.
if (index < oldindex) {
for (var j = oldindex; j > index; --j) {
this.list[j] = this.list[j - 1];
}
} else if (index > oldindex) {
// If shifting right, our target index is off-by-one because
// we ourselves are to the left of our destination index.
index -= 1;
for (var j = oldindex; j < index; ++j) {
this.list[j] = this.list[j + 1];
}
module.exports.indexOfPrefix = function (word) {
assert(typeof prefix === 'string', 'prefix must be string')
return binarySearch.ge(wordlist, word)
}
var xCoords = this.xCoords
var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX
var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX
var firstLevel = true
for(var scaleNum = scales.length-1; scaleNum >= 0; --scaleNum) {
var lod = scales[scaleNum]
if(lod.pixelSize < pixelSize && scaleNum > 1) {
continue
}
var intervalStart = lod.offset
var intervalEnd = lod.count + intervalStart
var startOffset = bsearch.ge(xCoords, xStart, intervalStart, intervalEnd-1)
var endOffset = bsearch.lt(xCoords, xEnd, startOffset, intervalEnd-1)+1
if(endOffset > startOffset) {
gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset)
}
if(firstLevel) {
firstLevel = false
shader.uniforms.useWeight = 0
}
}
}
})()
function levelIndex(list, i) {
return bounds.ge(list, i, compareLevel)
}
uniforms.dataShift = DATA_SHIFT
uniforms.dataScale = DATA_SCALE
var tickMarkLength = plot.tickMarkLength
var tickMarkWidth = plot.tickMarkWidth
var tickMarkColor = plot.tickMarkColor
var xTicksOffset = 0
var yTicksOffset = ticks[0].length * 6
var xStart = Math.min(bsearch.ge(ticks[0], (dataBox[0] - bounds[0]) / (bounds[2] - bounds[0]), compareTickNum), ticks[0].length)
var xEnd = Math.min(bsearch.gt(ticks[0], (dataBox[2] - bounds[0]) / (bounds[2] - bounds[0]), compareTickNum), ticks[0].length)
var xOffset = xTicksOffset + 6 * xStart
var xCount = 6 * Math.max(0, xEnd - xStart)
var yStart = Math.min(bsearch.ge(ticks[1], (dataBox[1] - bounds[1]) / (bounds[3] - bounds[1]), compareTickNum), ticks[1].length)
var yEnd = Math.min(bsearch.gt(ticks[1], (dataBox[3] - bounds[1]) / (bounds[3] - bounds[1]), compareTickNum), ticks[1].length)
var yOffset = yTicksOffset + 6 * yStart
var yCount = 6 * Math.max(0, yEnd - yStart)
SCR_OFFSET[0] = 2.0 * (viewBox[0] - tickMarkLength[1]) / screenWidth - 1.0
SCR_OFFSET[1] = (viewBox[3] + viewBox[1]) / screenHeight - 1.0
TICK_SCALE[0] = tickMarkLength[1] * pixelRatio / screenWidth
TICK_SCALE[1] = tickMarkWidth[1] * pixelRatio / screenHeight
if(yCount) {
uniforms.color = tickMarkColor[1]
uniforms.tickScale = TICK_SCALE
uniforms.dataAxis = Y_AXIS
uniforms.screenOffset = SCR_OFFSET
gl.drawArrays(gl.TRIANGLES, yOffset, yCount)
}