MCPcopy
hub / github.com/microsoft/SandDance / getPickingRect

Function getPickingRect

docs/tests/v2/es6/js/sanddance.js:45618–45641  ·  view source on GitHub ↗
(_ref5)

Source from the content-addressed store, hash-verified

45616
45617
45618function getPickingRect(_ref5) {
45619 var deviceX = _ref5.deviceX,
45620 deviceY = _ref5.deviceY,
45621 deviceRadius = _ref5.deviceRadius,
45622 deviceWidth = _ref5.deviceWidth,
45623 deviceHeight = _ref5.deviceHeight;
45624 var valid = deviceX >= 0 && deviceY >= 0 && deviceX < deviceWidth && deviceY < deviceHeight; // x, y out of bounds.
45625
45626 if (!valid) {
45627 return null;
45628 } // Create a box of size `radius * 2 + 1` centered at [deviceX, deviceY]
45629
45630
45631 var x = Math.max(0, deviceX - deviceRadius);
45632 var y = Math.max(0, deviceY - deviceRadius);
45633 var width = Math.min(deviceWidth, deviceX + deviceRadius) - x + 1;
45634 var height = Math.min(deviceHeight, deviceY + deviceRadius) - y + 1;
45635 return {
45636 x: x,
45637 y: y,
45638 width: width,
45639 height: height
45640 };
45641} // TODO - break this monster function into 3+ parts
45642
45643
45644function processPickInfo(_ref6) {

Callers 1

pickObjectFunction · 0.85

Calls 2

maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected