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

Function redraw

stackgl_modules/index.js:18918–19167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18916 var prevBounds = [nBounds[0].slice(), nBounds[1].slice()]
18917
18918 function redraw() {
18919 if(checkContextLoss()) {
18920 return
18921 }
18922
18923 resizeListener()
18924
18925 //Tick camera
18926 var cameraMoved = scene.camera.tick()
18927 cameraParams.view = scene.camera.matrix
18928 dirty = dirty || cameraMoved
18929 pickDirty = pickDirty || cameraMoved
18930
18931 //Set pixel ratio
18932 axes.pixelRatio = scene.pixelRatio
18933 spikes.pixelRatio = scene.pixelRatio
18934
18935 //Check if any objects changed, recalculate bounds
18936 var numObjs = objects.length
18937 var lo = nBounds[0]
18938 var hi = nBounds[1]
18939 lo[0] = lo[1] = lo[2] = Infinity
18940 hi[0] = hi[1] = hi[2] = -Infinity
18941 for(var i=0; i<numObjs; ++i) {
18942 var obj = objects[i]
18943
18944 //Set the axes properties for each object
18945 obj.pixelRatio = scene.pixelRatio
18946 obj.axes = scene.axes
18947
18948 dirty = dirty || !!obj.dirty
18949 pickDirty = pickDirty || !!obj.dirty
18950 var obb = obj.bounds
18951 if(obb) {
18952 var olo = obb[0]
18953 var ohi = obb[1]
18954 for(var j=0; j<3; ++j) {
18955 lo[j] = Math.min(lo[j], olo[j])
18956 hi[j] = Math.max(hi[j], ohi[j])
18957 }
18958 }
18959 }
18960
18961 //Recalculate bounds
18962 var bounds = scene.bounds
18963 if(scene.autoBounds) {
18964 for(var j=0; j<3; ++j) {
18965 if(hi[j] < lo[j]) {
18966 lo[j] = -1
18967 hi[j] = 1
18968 } else {
18969 if(lo[j] === hi[j]) {
18970 lo[j] -= 1
18971 hi[j] += 1
18972 }
18973 var padding = 0.05 * (hi[j] - lo[j])
18974 lo[j] = lo[j] - padding
18975 hi[j] = hi[j] + padding

Callers 2

renderFunction · 0.70
createSceneFunction · 0.70

Calls 5

checkContextLossFunction · 0.85
resizeListenerFunction · 0.85
roundUpPow10Function · 0.85
calcCameraParamsFunction · 0.85
renderPickFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…