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

Function pathCornerForPolygons

src/plots/polar/polar.js:897–929  ·  view source on GitHub ↗
(r, va0, va1)

Source from the content-addressed store, hash-verified

895 // ... we could eventually add another mode for cursor
896 // angles 'close to' enough to a particular vertex.
897 function pathCornerForPolygons(r, va0, va1) {
898 if(r === 0) return _this.pathSector(2 * chw);
899
900 var xy0 = ra2xy(r, va0);
901 var xy1 = ra2xy(r, va1);
902 var x = clampTiny((xy0[0] + xy1[0]) / 2);
903 var y = clampTiny((xy0[1] + xy1[1]) / 2);
904 var innerPts, outerPts;
905
906 if(x && y) {
907 var m = y / x;
908 var mperp = -1 / m;
909 var midPts = findXYatLength(chw, m, x, y);
910 innerPts = findXYatLength(chl, mperp, midPts[0][0], midPts[0][1]);
911 outerPts = findXYatLength(chl, mperp, midPts[1][0], midPts[1][1]);
912 } else {
913 var dx, dy;
914 if(y) {
915 // horizontal handles
916 dx = chl;
917 dy = chw;
918 } else {
919 // vertical handles
920 dx = chw;
921 dy = chl;
922 }
923 innerPts = [[x - dx, y - dy], [x + dx, y - dy]];
924 outerPts = [[x - dx, y + dy], [x + dx, y + dy]];
925 }
926
927 return 'M' + innerPts.join('L') +
928 'L' + outerPts.reverse().join('L') + 'Z';
929 }
930
931 function zoomPrep() {
932 r0 = null;

Callers 1

zoomMoveForPolygonsFunction · 0.85

Calls 3

ra2xyFunction · 0.85
clampTinyFunction · 0.85
findXYatLengthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…