overflowHide.js 594 B

12345678910111213141516171819
  1. import { isOverflow, parseAABB } from '../utils/bounds';
  2. import { hide, show } from '../utils/style';
  3. /**
  4. * Hide the label when the label is overflowed from the element.
  5. */
  6. export const OverflowHide = (options) => {
  7. return (labels, coordinate) => {
  8. labels.forEach((l) => {
  9. show(l);
  10. const bounds = l.attr('bounds');
  11. const b = l.getLocalBounds();
  12. const overflow = isOverflow(parseAABB(b), bounds);
  13. if (overflow)
  14. hide(l);
  15. });
  16. return labels;
  17. };
  18. };
  19. //# sourceMappingURL=overflowHide.js.map