Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
positionData[count*2 + 2] = npos[0]
positionData[count*2 + 3] = npos[1]
positionData[count*2 + 4] = npos[2]
positionData[count*2 + 5] = npos[3]
}
}
// add stub
else {
positionData[count*2 + 2] = npos[count*2 - 2]
positionData[count*2 + 3] = npos[count*2 - 1]
positionData[count*2 + 4] = npos[count*2 - 2]
positionData[count*2 + 5] = npos[count*2 - 1]
}
state.positionBuffer(float32(positionData))
state.positionFractBuffer(fract32(positionData))
}
if (o.range) {
state.range = o.range
} else if (!state.range) {
state.range = state.bounds
}
if ((o.range || o.positions) && state.count) {
let bounds = state.bounds
let boundsW = bounds[2] - bounds[0],
boundsH = bounds[3] - bounds[1]
let rangeW = state.range[2] - state.range[0],
rangeH = state.range[3] - state.range[1]
else {
positionData[count*2 + 2] = npos[0]
positionData[count*2 + 3] = npos[1]
positionData[count*2 + 4] = npos[2]
positionData[count*2 + 5] = npos[3]
}
}
// add stub
else {
positionData[count*2 + 2] = npos[count*2 - 2]
positionData[count*2 + 3] = npos[count*2 - 1]
positionData[count*2 + 4] = npos[count*2 - 2]
positionData[count*2 + 5] = npos[count*2 - 1]
}
state.positionBuffer(float32(positionData))
state.positionFractBuffer(fract32(positionData))
}
if (o.range) {
state.range = o.range
} else if (!state.range) {
state.range = state.bounds
}
if ((o.range || o.positions) && state.count) {
let bounds = state.bounds
let boundsW = bounds[2] - bounds[0],
boundsH = bounds[3] - bounds[1]
let rangeW = state.range[2] - state.range[0],
let boundsW = bounds[2] - bounds[0],
boundsH = bounds[3] - bounds[1]
let rangeW = state.range[2] - state.range[0],
rangeH = state.range[3] - state.range[1]
state.scale = [
boundsW / rangeW,
boundsH / rangeH
]
state.translate = [
-state.range[0] / rangeW + bounds[0] / rangeW || 0,
-state.range[1] / rangeH + bounds[1] / rangeH || 0
]
state.scaleFract = fract32(state.scale)
state.translateFract = fract32(state.translate)
}
if (o.dashes) {
let dashLength = 0., dashData
if (!o.dashes || o.dashes.length < 2) {
dashLength = 1.
dashData = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255])
}
else {
dashLength = 0.;
for(let i = 0; i < o.dashes.length; ++i) {
dashLength += o.dashes[i]
}
range: (range, state, options) => {
let bounds = state.bounds
if (!range) range = bounds
state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])]
state.translate = [-range[0], -range[1]]
state.scaleFract = fract32(state.scale)
state.translateFract = fract32(state.translate)
return range
},
range: (range, state, options) => {
let bounds = state.bounds
if (!range) range = bounds
state.scale = [1 / (range[2] - range[0]), 1 / (range[3] - range[1])]
state.translate = [-range[0], -range[1]]
state.scaleFract = fract32(state.scale)
state.translateFract = fract32(state.translate)
return range
},
let positionData = new Float64Array(len * 2)
let colorData = new Uint8Array(len * 4)
let errorData = new Float32Array(len * 4)
groups.forEach((group, i) => {
if (!group) return
let {positions, count, offset, color, errors} = group
if (!count) return
colorData.set(color, offset * 4)
errorData.set(errors, offset * 4)
positionData.set(positions, offset * 2)
})
positionBuffer(float32(positionData))
positionFractBuffer(fract32(positionData))
colorBuffer(colorData)
errorBuffer(errorData)
}
}
boundsH = bounds[3] - bounds[1]
let rangeW = state.range[2] - state.range[0],
rangeH = state.range[3] - state.range[1]
state.scale = [
boundsW / rangeW,
boundsH / rangeH
]
state.translate = [
-state.range[0] / rangeW + bounds[0] / rangeW || 0,
-state.range[1] / rangeH + bounds[1] / rangeH || 0
]
state.scaleFract = fract32(state.scale)
state.translateFract = fract32(state.translate)
}
if (o.dashes) {
let dashLength = 0., dashData
if (!o.dashes || o.dashes.length < 2) {
dashLength = 1.
dashData = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255])
}
else {
dashLength = 0.;
for(let i = 0; i < o.dashes.length; ++i) {
dashLength += o.dashes[i]
}
dashData = new Uint8Array(dashLength * Line2D.dashMult)
let positionData = new Float64Array(len * 2)
let colorData = new Uint8Array(len * 4)
let errorData = new Float32Array(len * 4)
groups.forEach((group, i) => {
if (!group) return
let {positions, count, offset, color, errors} = group
if (!count) return
colorData.set(color, offset * 4)
errorData.set(errors, offset * 4)
positionData.set(positions, offset * 2)
})
positionBuffer(float32(positionData))
positionFractBuffer(fract32(positionData))
colorBuffer(colorData)
errorBuffer(errorData)
}
}