Exemplo n.º 1
0
  def isInViewPort(self) -> JsObjects.JsObject.JsObject:
    """
    Description:
    -----------
    Check if the component is in the visible part of the page (the viewport).

    :return: A Javascript boolean
    """
    flag = JsBoolean.JsBoolean("!(rect.bottom < 0 || rect.top - viewHeight >= 0)", js_code="visibleFlag", set_var=True,
                               is_py_data=False)
    flag._js.insert(0, self.component.js.viewHeight.setVar('viewHeight'))
    flag._js.insert(0, self.getBoundingClientRect().setVar("rect"))
    return JsFncs.JsAnonymous(flag.r).return_("visibleFlag").call()
Exemplo n.º 2
0
  def isInViewPort(self):
    """
    Description:
    -----------
    Check if the component is in the visible part of the page (the viewpport)

    :rtype: JsObject.JsObject

    :return: A Javascript boolean
    """
    bool = JsBoolean.JsBoolean("!(rect.bottom < 0 || rect.top - viewHeight >= 0)", varName="visibleFlag", setVar=True, isPyData=False)
    bool._js.insert(0, self._report.js.viewHeight.setVar('viewHeight'))
    bool._js.insert(0, self.getBoundingClientRect().setVar("rect"))
    return JsFncs.JsAnonymous(bool.r).return_("visibleFlag").call()