caplin / FlexLayout

Docking Layout Manager for React
MIT License
920 stars 174 forks source link

Is there a way to determine if a node is on an edge? #293

Open vegemite4me opened 2 years ago

vegemite4me commented 2 years ago

This is a great piece of kit. Thank you for sharing this package.

I would like to know if it is possible to determine if a node (or is it tab?) is touching an edge. In my specific situation I need to know if that node is touching the bottom of the window, as I need to add an additional class to the contents of that node.

For example, here are three layouts. I need to know when a node is touching the bottom edge of the window - I have shaded these green.

flexlayout-bottom-edge

Is there a function I can call or a property I can check to find out if a node is touching an edge?

eric-ho-github commented 2 years ago

you can use getRect https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/typedoc/classes/TabNode.html#getRect

then compare approximately (rect.y + rect.height) to the root layout container rect