@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
14 lines (13 loc) • 481 B
JavaScript
;
export function textGeometryOffset(params) {
params.previousGeometry.computeBoundingBox();
params.geometry.computeBoundingBox();
const previousBbox = params.previousGeometry.boundingBox;
const currentBbox = params.geometry.boundingBox;
if (!(previousBbox && currentBbox)) {
return;
}
const currentHeight = Math.abs(currentBbox.max.y - currentBbox.min.y);
const offset = previousBbox.min.y - (currentHeight + params.lineHeight);
return offset;
}