# Viewport and get visible rect in child component

**URL:** <https://forum.juce.com/t/viewport-and-get-visible-rect-in-child-component/15468>\
**Category:** General JUCE discussion\
**Created:** [September 3, 2015, 1:03pm UTC](https://forum.juce.com/t/viewport-and-get-visible-rect-in-child-component/15468 "2015-09-03T13:03:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 3, 2015, 1:03pm UTC](https://forum.juce.com/t/viewport-and-get-visible-rect-in-child-component/15468/1 "2015-09-03T13:03:24Z")

</div>

Hi Jules,

&nbsp;

Is there a way to get the visible portion of a component in a viewport in the child component wirthout

asking for the viewport ?

The widget doesn't know it is a viewport

&nbsp;

Right now I'm using the&nbsp;getClipBounds of the Graphics but it could be smaller in case of a partial redraw.

&nbsp;

Thanks,

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 3, 2015, 1:21pm UTC](https://forum.juce.com/t/viewport-and-get-visible-rect-in-child-component/15468/2 "2015-09-03T13:21:37Z")

</div>

You could convert the bounds of the child component into the parent's coord space, and then clip it to the parent's bounds? Doing that operation recursively would be a more general way of getting the visible area.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 3, 2015, 1:24pm UTC](https://forum.juce.com/t/viewport-and-get-visible-rect-in-child-component/15468/3 "2015-09-03T13:24:25Z")

</div>

Good idea.

Thanks !
