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

Function drawSlider

src/components/sliders/draw.js:247–273  ·  view source on GitHub ↗
(gd, sliderGroup, sliderOpts)

Source from the content-addressed store, hash-verified

245}
246
247function drawSlider(gd, sliderGroup, sliderOpts) {
248 // This is related to the other long notes in this file regarding what happens
249 // when slider steps disappear. This particular fix handles what happens when
250 // the *current* slider step is removed. The drawing functions will error out
251 // when they fail to find it, so the fix for now is that it will just draw the
252 // slider in the first position but will not execute the command.
253 if(!((sliderOpts.steps[sliderOpts.active] || {}).visible)) {
254 sliderOpts.active = sliderOpts._visibleSteps[0]._index;
255 }
256
257 // These are carefully ordered for proper z-ordering:
258 sliderGroup
259 .call(drawCurrentValue, sliderOpts)
260 .call(drawRail, sliderOpts)
261 .call(drawLabelGroup, sliderOpts)
262 .call(drawTicks, sliderOpts)
263 .call(drawTouchRect, gd, sliderOpts)
264 .call(drawGrip, gd, sliderOpts);
265
266 var dims = sliderOpts._dims;
267
268 // Position the rectangle:
269 Drawing.setTranslate(sliderGroup, dims.lx + sliderOpts.pad.l, dims.ly + sliderOpts.pad.t);
270
271 sliderGroup.call(setGripPosition, sliderOpts, false);
272 sliderGroup.call(drawCurrentValue, sliderOpts);
273}
274
275function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) {
276 if(!sliderOpts.currentvalue.visible) return;

Callers 1

draw.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…