@macrostrat/column-components
Version:
React rendering primitives for stratigraphic columns
37 lines (30 loc) • 1.47 kB
JavaScript
import $f5b828bbb980a05d$export$2e2bcd8739ae039 from "./column-components.e1d11b63.js";
import {NoteLayoutContext as $00c4b971e86fe1d8$export$20c7bffdb69233c9} from "./column-components.2a78b581.js";
import {useContext as $icLR5$useContext} from "react";
function $dfac63f354e170ff$export$664019b81938583(props) {
const { scale: scale } = (0, $icLR5$useContext)((0, $00c4b971e86fe1d8$export$20c7bffdb69233c9));
const { height: height, top_height: top_height, offsetX: offsetX = 0, color: color, lineInset: lineInset = 1, ...rest } = props;
const bottomHeight = scale(height);
let pxHeight = 0;
if (top_height != null) pxHeight = Math.abs(scale(top_height) - bottomHeight);
const topHeight = bottomHeight - pxHeight;
const isLine = pxHeight > 2 * lineInset;
const transform = `translate(${offsetX},${topHeight})`;
return (0, $f5b828bbb980a05d$export$2e2bcd8739ae039)("g.height-range", {
transform: transform,
...rest
}, [
(0, $f5b828bbb980a05d$export$2e2bcd8739ae039).if(isLine)("line", {
x1: 0,
x2: 0,
y1: lineInset,
y2: pxHeight - lineInset
}),
(0, $f5b828bbb980a05d$export$2e2bcd8739ae039).if(!isLine)("circle", {
r: 2,
transform: `translate(0,${pxHeight / 2})`
})
]);
}
export {$dfac63f354e170ff$export$664019b81938583 as HeightRangeAnnotation};
//# sourceMappingURL=column-components.f9292ad0.js.map