pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
34 lines (30 loc) • 1.25 kB
JavaScript
;
var getLocalBounds = require('../../../scene/container/bounds/getLocalBounds.js');
var matrixAndBoundsPool = require('../../../scene/container/bounds/utils/matrixAndBoundsPool.js');
var warn = require('../../../utils/logging/warn.js');
;
function addMaskLocalBounds(mask, bounds, localRoot) {
const boundsToMask = matrixAndBoundsPool.boundsPool.get();
mask.measurable = true;
const tempMatrix = matrixAndBoundsPool.matrixPool.get().identity();
const relativeMask = getMatrixRelativeToParent(mask, localRoot, tempMatrix);
getLocalBounds.getLocalBounds(mask, boundsToMask, relativeMask);
mask.measurable = false;
bounds.addBoundsMask(boundsToMask);
matrixAndBoundsPool.matrixPool.return(tempMatrix);
matrixAndBoundsPool.boundsPool.return(boundsToMask);
}
function getMatrixRelativeToParent(target, root, matrix) {
if (!target) {
warn.warn("Mask bounds, renderable is not inside the root container");
return matrix;
}
if (target !== root) {
getMatrixRelativeToParent(target.parent, root, matrix);
target.updateLocalTransform();
matrix.append(target.localTransform);
}
return matrix;
}
exports.addMaskLocalBounds = addMaskLocalBounds;
//# sourceMappingURL=addMaskLocalBounds.js.map