MCPcopy Index your code
hub / github.com/microsoft/SandDance / pathRender

Function pathRender

docs/app/js/sanddance-app.js:121320–121520  ·  view source on GitHub ↗
(context1, path2, l, t, sX, sY)

Source from the content-addressed store, hash-verified

121318 return temp;
121319}
121320function pathRender(context1, path2, l, t, sX, sY) {
121321 var current, // current instruction
121322 previous = null, x4 = 0, // current x
121323 y4 = 0, // current y
121324 controlX = 0, // current control point x
121325 controlY = 0, // current control point y
121326 tempX, tempY, tempControlX, tempControlY;
121327 if (l == null) l = 0;
121328 if (t == null) t = 0;
121329 if (sX == null) sX = 1;
121330 if (sY == null) sY = sX;
121331 if (context1.beginPath) context1.beginPath();
121332 for(var i = 0, len = path2.length; i < len; ++i){
121333 current = path2[i];
121334 if (sX !== 1 || sY !== 1) current = scale$1(current, sX, sY);
121335 switch(current[0]){
121336 // first letter
121337 case "l":
121338 // lineto, relative
121339 x4 += current[1];
121340 y4 += current[2];
121341 context1.lineTo(x4 + l, y4 + t);
121342 break;
121343 case "L":
121344 // lineto, absolute
121345 x4 = current[1];
121346 y4 = current[2];
121347 context1.lineTo(x4 + l, y4 + t);
121348 break;
121349 case "h":
121350 // horizontal lineto, relative
121351 x4 += current[1];
121352 context1.lineTo(x4 + l, y4 + t);
121353 break;
121354 case "H":
121355 // horizontal lineto, absolute
121356 x4 = current[1];
121357 context1.lineTo(x4 + l, y4 + t);
121358 break;
121359 case "v":
121360 // vertical lineto, relative
121361 y4 += current[1];
121362 context1.lineTo(x4 + l, y4 + t);
121363 break;
121364 case "V":
121365 // verical lineto, absolute
121366 y4 = current[1];
121367 context1.lineTo(x4 + l, y4 + t);
121368 break;
121369 case "m":
121370 // moveTo, relative
121371 x4 += current[1];
121372 y4 += current[2];
121373 context1.moveTo(x4 + l, y4 + t);
121374 break;
121375 case "M":
121376 // moveTo, absolute
121377 x4 = current[1];

Callers 2

customSymbolFunction · 0.70
path$1Function · 0.70

Calls 5

scale$1Function · 0.70
drawArcFunction · 0.70
lineToMethod · 0.45
moveToMethod · 0.45
closePathMethod · 0.45

Tested by

no test coverage detected