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

Function hit

docs/app/js/sanddance-app.js:123008–123014  ·  view source on GitHub ↗
(context, item, x, y, gx, gy)

Source from the content-addressed store, hash-verified

123006 });
123007}
123008function hit(context, item, x, y, gx, gy) {
123009 if (item.fontSize <= 0) return false;
123010 if (!item.angle) return true; // bounds sufficient if no rotation
123011 // project point into space of unrotated bounds
123012 var p = anchorPoint(item), ax = p.x1, ay = p.y1, b15 = bound(tempBounds, item, 1), a = -item.angle * DegToRad, cos = Math.cos(a), sin = Math.sin(a), px4 = cos * gx - sin * gy + (ax - cos * ax + sin * ay), py4 = sin * gx + cos * gy + (ay - sin * ax - cos * ay);
123013 return b15.contains(px4, py4);
123014}
123015function intersectText(item, box) {
123016 const p = bound(tempBounds, item, 2);
123017 return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]);

Callers

nothing calls this directly

Calls 3

anchorPointFunction · 0.70
boundFunction · 0.70
containsMethod · 0.45

Tested by

no test coverage detected