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

Function clipPointsByRect

libs/echarts/echarts-en.simple.js:18095–18107  ·  view source on GitHub ↗

* @param {Array. >} points Like: [[23, 44], [53, 66], ...] * @param {Object} rect {x, y, width, height} * @return {Array. >} A new clipped points.

(points, rect)

Source from the content-addressed store, hash-verified

18093 * @return {Array.<Array.<number>>} A new clipped points.
18094 */
18095function clipPointsByRect(points, rect) {
18096 // FIXME: this way migth be incorrect when grpahic clipped by a corner.
18097 // and when element have border.
18098 return map(points, function (point) {
18099 var x = point[0];
18100 x = mathMax$1(x, rect.x);
18101 x = mathMin$1(x, rect.x + rect.width);
18102 var y = point[1];
18103 y = mathMax$1(y, rect.y);
18104 y = mathMin$1(y, rect.y + rect.height);
18105 return [x, y];
18106 });
18107}
18108
18109/**
18110 * @param {Object} targetRect {x, y, width, height}

Callers

nothing calls this directly

Calls 1

mapFunction · 0.70

Tested by

no test coverage detected