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

Function pick

docs/tests/v2/es6/js/sanddance.js:98956–98969  ·  view source on GitHub ↗
(test)

Source from the content-addressed store, hash-verified

98954var _vegaUtil = require("vega-util");
98955
98956function pick(test) {
98957 test = test || _vegaUtil.truthy;
98958 return function (context, scene, x, y, gx, gy) {
98959 x *= context.pixelRatio;
98960 y *= context.pixelRatio;
98961 return (0, _visit.pickVisit)(scene, function (item) {
98962 var b = item.bounds; // first hit test against bounding box
98963
98964 if (b && !b.contains(gx, gy) || !b) return; // if in bounding box, perform more careful test
98965
98966 if (test(context, item, x, y, gx, gy)) return item;
98967 });
98968 };
98969}
98970
98971function hitPath(path, filled) {
98972 return function (context, o, x, y) {

Callers 1

pickPathFunction · 0.70

Calls 7

restoreMethod · 0.80
hitFunction · 0.70
pickMarkFunction · 0.70
saveMethod · 0.65
testFunction · 0.50
containsMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected