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

Function getMultiAxisClipRect

src/components/shapes/draw.js:258–284  ·  view source on GitHub ↗
(gd, xref, yref)

Source from the content-addressed store, hash-verified

256}
257
258function getMultiAxisClipRect(gd, xref, yref) {
259 const gs = gd._fullLayout._size;
260
261 function getBounds(refs, isVertical) {
262 // Retrieve all existing axes from the references
263 const axes = (Array.isArray(refs) ? refs : [refs]).map((r) => Axes.getFromId(gd, r)).filter(Boolean);
264
265 // If no valid axes, return the bounds of the larger plot area
266 if (!axes.length) {
267 return isVertical ? [gs.t, gs.t + gs.h] : [gs.l, gs.l + gs.w];
268 }
269
270 // Otherwise, we find all find and return the smallest start point
271 // and largest end point to be used as the clip bounds
272 const startBounds = axes.map(function (ax) {
273 return ax._offset;
274 });
275 const endBounds = axes.map(function (ax) {
276 return ax._offset + ax._length;
277 });
278 return [Math.min(...startBounds), Math.max(...endBounds)];
279 }
280
281 const xb = getBounds(xref, false);
282 const yb = getBounds(yref, true);
283 return { x: xb[0], y: yb[0], width: xb[1] - xb[0], height: yb[1] - yb[0] };
284}
285
286function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHelpers) {
287 var MINWIDTH = 10;

Callers 1

setClipPathFunction · 0.85

Calls 1

getBoundsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…