MCPcopy
hub / github.com/apache/echarts / projectPointToRect

Function projectPointToRect

src/label/labelGuideHelper.ts:179–197  ·  view source on GitHub ↗
(
    x1: number, y1: number, width: number, height: number, x: number, y: number, out: number[]
)

Source from the content-addressed store, hash-verified

177}
178
179function projectPointToRect(
180 x1: number, y1: number, width: number, height: number, x: number, y: number, out: number[]
181): number {
182 if (width < 0) {
183 x1 = x1 + width;
184 width = -width;
185 }
186 if (height < 0) {
187 y1 = y1 + height;
188 height = -height;
189 }
190 const x2 = x1 + width;
191 const y2 = y1 + height;
192
193 const ox = out[0] = Math.min(Math.max(x, x1), x2);
194 const oy = out[1] = Math.min(Math.max(y, y1), y2);
195
196 return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));
197}
198
199const tmpPt: number[] = [];
200

Callers 2

nearestPointOnRectFunction · 0.85
nearestPointOnPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…