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

Function hitPath

docs/tests/v2/es6/js/sanddance.js:98971–98988  ·  view source on GitHub ↗
(path, filled)

Source from the content-addressed store, hash-verified

98969}
98970
98971function hitPath(path, filled) {
98972 return function (context, o, x, y) {
98973 var item = Array.isArray(o) ? o[0] : o,
98974 fill = filled == null ? item.fill : filled,
98975 stroke = item.stroke && context.isPointInStroke,
98976 lw,
98977 lc;
98978
98979 if (stroke) {
98980 lw = item.strokeWidth;
98981 lc = item.strokeCap;
98982 context.lineWidth = lw != null ? lw : 1;
98983 context.lineCap = lc != null ? lc : 'butt';
98984 }
98985
98986 return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y);
98987 };
98988}
98989
98990function pickPath(path) {
98991 return pick(hitPath(path));

Callers 1

pickPathFunction · 0.70

Calls 1

pathFunction · 0.70

Tested by

no test coverage detected