victory-native
Version:
A charting library for React Native with a focus on performance and customization.
31 lines (30 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pruneChartPressBootstrap = void 0;
const hasReleasedTouchId = (touchId, changedTouches) => {
"worklet";
var _a;
for (let i = 0; i < changedTouches.length; i++) {
if (((_a = changedTouches[i]) === null || _a === void 0 ? void 0 : _a.id) === touchId)
return true;
}
return false;
};
const pruneChartPressBootstrap = ({ bootstrap, changedTouches, numberOfTouches, }) => {
"worklet";
if (numberOfTouches === 0)
return [];
const nextBootstrap = [];
for (let i = 0; i < bootstrap.length; i++) {
const entry = bootstrap[i];
const touchId = entry === null || entry === void 0 ? void 0 : entry.touch.id;
if (typeof touchId === "number" &&
hasReleasedTouchId(touchId, changedTouches)) {
continue;
}
if (entry)
nextBootstrap.push(entry);
}
return nextBootstrap;
};
exports.pruneChartPressBootstrap = pruneChartPressBootstrap;