MCPcopy Create free account
hub / github.com/microsoft/SandDance / adjustSpatial

Function adjustSpatial

docs/app/js/sanddance-app.js:146345–146363  ·  view source on GitHub ↗
(encode, marktype)

Source from the content-addressed store, hash-verified

146343 "rect"
146344]);
146345function adjustSpatial(encode, marktype) {
146346 let code = "";
146347 if (Skip[marktype]) return code;
146348 if (encode.x2) {
146349 if (encode.x) {
146350 if (Swap[marktype]) code += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;";
146351 code += "o.width=o.x2-o.x;";
146352 } else code += "o.x=o.x2-(o.width||0);";
146353 }
146354 if (encode.xc) code += "o.x=o.xc-(o.width||0)/2;";
146355 if (encode.y2) {
146356 if (encode.y) {
146357 if (Swap[marktype]) code += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;";
146358 code += "o.height=o.y2-o.y;";
146359 } else code += "o.y=o.y2-(o.height||0);";
146360 }
146361 if (encode.yc) code += "o.y=o.yc-(o.height||0)/2;";
146362 return code;
146363}
146364function canonicalType(type) {
146365 return (type + "").toLowerCase();
146366}

Callers 1

sanddance-app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected