MCPcopy Create free account
hub / github.com/plotly/plotly.js / clampAndSetR0R1

Function clampAndSetR0R1

src/plots/polar/polar.js:948–974  ·  view source on GitHub ↗
(rr0, rr1)

Source from the content-addressed store, hash-verified

946 // N.B. this sets scoped 'r0' and 'r1'
947 // return true if 'valid' zoom distance, false otherwise
948 function clampAndSetR0R1(rr0, rr1) {
949 rr1 = Math.max(Math.min(rr1, radius), innerRadius);
950
951 // starting or ending drag near center (outer edge),
952 // clamps radial distance at origin (at r=radius)
953 if(rr0 < OFFEDGE) rr0 = 0;
954 else if((radius - rr0) < OFFEDGE) rr0 = radius;
955 else if(rr1 < OFFEDGE) rr1 = 0;
956 else if((radius - rr1) < OFFEDGE) rr1 = radius;
957
958 // make sure r0 < r1,
959 // to get correct fill pattern in path1 below
960 if(Math.abs(rr1 - rr0) > MINZOOM) {
961 if(rr0 < rr1) {
962 r0 = rr0;
963 r1 = rr1;
964 } else {
965 r0 = rr1;
966 r1 = rr0;
967 }
968 return true;
969 } else {
970 r0 = null;
971 r1 = null;
972 return false;
973 }
974 }
975
976 function applyZoomMove(path1, cpath) {
977 path1 = path1 || path0;

Callers 2

zoomMoveFunction · 0.85
zoomMoveForPolygonsFunction · 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…