Package com.sencha.gxt.core.client.Style

Examples of com.sencha.gxt.core.client.Style.Anchor


   */
  public final Point getAlignToXY(Element elem, AnchorAlignment alignment, int ox, int oy) {
    XElement el = XElement.as(elem);

    boolean constrainViewport = alignment.isConstrainViewport();
    Anchor anch1 = alignment.getAlign();
    Anchor anch2 = alignment.getTargetAlign();
    // Subtract the aligned el's internal xy from the target's offset xy
    // plus custom offset to get the aligned el's new offset xy
    Point a1 = getAnchorXY(anch1, true);
    Point a2 = el.getAnchorXY(anch2, false);

    int x = a2.getX() - a1.getX() + ox;
    int y = a2.getY() - a1.getY() + oy;

    if (constrainViewport) {
      // constrain the aligned el to viewport if necessary
      int w = getOffsetWidth();
      int h = getOffsetHeight();
      Region r = el.getRegion();
      // 5px of margin for ie
      int dw = XDOM.getViewWidth(false) - 10;
      int dh = XDOM.getViewHeight(false) - 10;

      // If we are at a viewport boundary and the aligned el is anchored on a
      // target border that is
      // perpendicular to the vp border, allow the aligned el to slide on that
      // border,
      // otherwise swap the aligned el to the opposite border of the target.
      boolean swapY = (anch1.isTop() && anch2.isBottom()) || (anch1.isBottom() && anch2.isTop());
      boolean swapX = (anch1.isRight() && anch2.isLeft()) || (anch1.isLeft() && anch2.isRight());

      // EXTGWT-1730 only applying 5 when there is scrolling. 5 may be able to
      // be removed
      // but not sure why this was added in first place. it exists in 2.0
      int scrollX = XDOM.getBodyScrollLeft();
View Full Code Here


    // to sync anchor
    show();
  }

  protected void syncAnchor() {
    Anchor anchorPos, targetPos;
    final int offsetX, offsetY;
    int anchorOffset = toolTipConfig.getAnchorOffset();
    switch (toolTipConfig.getAnchor()) {
      case TOP:
        anchorPos = Anchor.BOTTOM;
View Full Code Here

    // to sync anchor
    show();
  }

  protected void syncAnchor() {
    Anchor anchorPos, targetPos;
    int[] offset;
    int anchorOffset = toolTipConfig.getAnchorOffset();
    switch (toolTipConfig.getAnchor()) {
      case TOP:
        anchorPos = Anchor.BOTTOM;
View Full Code Here

TOP

Related Classes of com.sencha.gxt.core.client.Style.Anchor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.