MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / buildPath

Function buildPath

libs/echarts/echarts.simple.js:8286–8364  ·  view source on GitHub ↗

* @param {Object} ctx * @param {Object} shape * @param {number} shape.x * @param {number} shape.y * @param {number} shape.width * @param {number} shape.height * @param {number} shape.r

(ctx, shape)

Source from the content-addressed store, hash-verified

8284 * @param {number} shape.r
8285 */
8286function buildPath(ctx, shape) {
8287 var x = shape.x;
8288 var y = shape.y;
8289 var width = shape.width;
8290 var height = shape.height;
8291 var r = shape.r;
8292 var r1;
8293 var r2;
8294 var r3;
8295 var r4;
8296
8297 // Convert width and height to positive for better borderRadius
8298 if (width < 0) {
8299 x = x + width;
8300 width = -width;
8301 }
8302 if (height < 0) {
8303 y = y + height;
8304 height = -height;
8305 }
8306
8307 if (typeof r === 'number') {
8308 r1 = r2 = r3 = r4 = r;
8309 }
8310 else if (r instanceof Array) {
8311 if (r.length === 1) {
8312 r1 = r2 = r3 = r4 = r[0];
8313 }
8314 else if (r.length === 2) {
8315 r1 = r3 = r[0];
8316 r2 = r4 = r[1];
8317 }
8318 else if (r.length === 3) {
8319 r1 = r[0];
8320 r2 = r4 = r[1];
8321 r3 = r[2];
8322 }
8323 else {
8324 r1 = r[0];
8325 r2 = r[1];
8326 r3 = r[2];
8327 r4 = r[3];
8328 }
8329 }
8330 else {
8331 r1 = r2 = r3 = r4 = 0;
8332 }
8333
8334 var total;
8335 if (r1 + r2 > width) {
8336 total = r1 + r2;
8337 r1 *= width / total;
8338 r2 *= width / total;
8339 }
8340 if (r3 + r4 > width) {
8341 total = r3 + r4;
8342 r3 *= width / total;
8343 r4 *= width / total;

Callers 2

drawBackgroundFunction · 0.70
echarts.simple.jsFile · 0.70

Calls 2

arcMethod · 0.80
moveToMethod · 0.45

Tested by

no test coverage detected