MCPcopy Index your code
hub / github.com/plotly/plotly.js / createLines

Function createLines

stackgl_modules/index.js:12842–12895  ·  view source on GitHub ↗
(gl, bounds, ticks)

Source from the content-addressed store, hash-verified

12840}
12841
12842function createLines(gl, bounds, ticks) {
12843 var vertices = []
12844 var tickOffset = [0,0,0]
12845 var tickCount = [0,0,0]
12846
12847 //Create grid lines for each axis/direction
12848 var gridOffset = [0,0,0]
12849 var gridCount = [0,0,0]
12850
12851 //Add zero line
12852 vertices.push(
12853 0,0,1, 0,1,1, 0,0,-1,
12854 0,0,-1, 0,1,1, 0,1,-1)
12855
12856 for(var i=0; i<3; ++i) {
12857 //Axis tick marks
12858 var start = ((vertices.length / 3)|0)
12859 for(var j=0; j<ticks[i].length; ++j) {
12860 var x = +ticks[i][j].x
12861 vertices.push(
12862 x,0,1, x,1,1, x,0,-1,
12863 x,0,-1, x,1,1, x,1,-1)
12864 }
12865 var end = ((vertices.length / 3)|0)
12866 tickOffset[i] = start
12867 tickCount[i] = end - start
12868
12869 //Grid lines
12870 var start = ((vertices.length / 3)|0)
12871 for(var k=0; k<ticks[i].length; ++k) {
12872 var x = +ticks[i][k].x
12873 vertices.push(
12874 x,0,1, x,1,1, x,0,-1,
12875 x,0,-1, x,1,1, x,1,-1)
12876 }
12877 var end = ((vertices.length / 3)|0)
12878 gridOffset[i] = start
12879 gridCount[i] = end - start
12880 }
12881
12882 //Create cube VAO
12883 var vertBuf = createBuffer(gl, new Float32Array(vertices))
12884 var vao = createVAO(gl, [
12885 { "buffer": vertBuf,
12886 "type": gl.FLOAT,
12887 "size": 3,
12888 "stride": 0,
12889 "offset": 0
12890 }
12891 ])
12892 var shader = createShader(gl)
12893 shader.attributes.position.location = 0
12894 return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset)
12895}
12896
12897
12898/***/ }),

Callers 1

index.jsFile · 0.85

Calls 3

createBufferFunction · 0.85
createVAOFunction · 0.85
createShaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…