当前位置: 首页>>代码示例>>Java>>正文


Java Handle.TOP_RIGHT属性代码示例

本文整理汇总了Java中com.edmodo.cropper.cropwindow.handle.Handle.TOP_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java Handle.TOP_RIGHT属性的具体用法?Java Handle.TOP_RIGHT怎么用?Java Handle.TOP_RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.edmodo.cropper.cropwindow.handle.Handle的用法示例。


在下文中一共展示了Handle.TOP_RIGHT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPressedHandle

/**
 * Determines which, if any, of the handles are pressed given the touch
 * coordinates, the bounding box, and the touch radius.
 *
 * @param x            the x-coordinate of the touch point
 * @param y            the y-coordinate of the touch point
 * @param left         the x-coordinate of the left bound
 * @param top          the y-coordinate of the top bound
 * @param right        the x-coordinate of the right bound
 * @param bottom       the y-coordinate of the bottom bound
 * @param targetRadius the target radius in pixels
 * @return the Handle that was pressed; null if no Handle was pressed
 */
public static Handle getPressedHandle(float x,
                                      float y,
                                      float left,
                                      float top,
                                      float right,
                                      float bottom,
                                      float targetRadius) {

    Handle pressedHandle = null;

    // Note: corner-handles take precedence, then side-handles, then center.

    if (HandleUtil.isInCornerTargetZone(x, y, left, top, targetRadius)) {
        pressedHandle = Handle.TOP_LEFT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, right, top, targetRadius)) {
        pressedHandle = Handle.TOP_RIGHT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, left, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM_LEFT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, right, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM_RIGHT;
    } else if (HandleUtil.isInCenterTargetZone(x, y, left, top, right, bottom) && focusCenter()) {
        pressedHandle = Handle.CENTER;
    } else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, top, targetRadius)) {
        pressedHandle = Handle.TOP;
    } else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, left, top, bottom, targetRadius)) {
        pressedHandle = Handle.LEFT;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, right, top, bottom, targetRadius)) {
        pressedHandle = Handle.RIGHT;
    } else if (HandleUtil.isInCenterTargetZone(x, y, left, top, right, bottom) && !focusCenter()) {
        pressedHandle = Handle.CENTER;

    }

    return pressedHandle;
}
 
开发者ID:g82,项目名称:open-mygirl-android-gradle,代码行数:50,代码来源:HandleUtil.java

示例2: getPressedHandle

/**
 * Determines which, if any, of the handles are pressed given the touch
 * coordinates, the bounding box, and the touch radius.
 * 
 * @param x the x-coordinate of the touch point
 * @param y the y-coordinate of the touch point
 * @param left the x-coordinate of the left bound
 * @param top the y-coordinate of the top bound
 * @param right the x-coordinate of the right bound
 * @param bottom the y-coordinate of the bottom bound
 * @param targetRadius the target radius in pixels
 * @return the Handle that was pressed; null if no Handle was pressed
 */
public static Handle getPressedHandle(float x,
                                      float y,
                                      float left,
                                      float top,
                                      float right,
                                      float bottom,
                                      float targetRadius) {

    Handle pressedHandle = null;

    // Note: corner-handles take precedence, then side-handles, then center.

    if (HandleUtil.isInCornerTargetZone(x, y, left, top, targetRadius)) {
        pressedHandle = Handle.TOP_LEFT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, right, top, targetRadius)) {
        pressedHandle = Handle.TOP_RIGHT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, left, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM_LEFT;
    } else if (HandleUtil.isInCornerTargetZone(x, y, right, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM_RIGHT;
    } else if (HandleUtil.isInCenterTargetZone(x, y, left, top, right, bottom) && focusCenter()) {
        pressedHandle = Handle.CENTER;
    } else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, top, targetRadius)) {
        pressedHandle = Handle.TOP;
    } else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, bottom, targetRadius)) {
        pressedHandle = Handle.BOTTOM;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, left, top, bottom, targetRadius)) {
        pressedHandle = Handle.LEFT;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, right, top, bottom, targetRadius)) {
        pressedHandle = Handle.RIGHT;
    } else if (HandleUtil.isInCenterTargetZone(x, y, left, top, right, bottom) && !focusCenter()) {
        pressedHandle = Handle.CENTER;

    }

    return pressedHandle;
}
 
开发者ID:wangeason,项目名称:PhotoViewCropper,代码行数:50,代码来源:HandleUtil.java

示例3: getPressedHandle

public static Handle getPressedHandle(float f, float f1, float f2, float f3, float f4, float f5, float f6)
{
    if (a(f, f1, f2, f3, f6))
    {
        return Handle.TOP_LEFT;
    }
    if (a(f, f1, f4, f3, f6))
    {
        return Handle.TOP_RIGHT;
    }
    if (a(f, f1, f2, f5, f6))
    {
        return Handle.BOTTOM_LEFT;
    }
    if (a(f, f1, f4, f5, f6))
    {
        return Handle.BOTTOM_RIGHT;
    }
    if (c(f, f1, f2, f3, f4, f5) && a())
    {
        return Handle.CENTER;
    }
    if (a(f, f1, f2, f4, f3, f6))
    {
        return Handle.TOP;
    }
    if (a(f, f1, f2, f4, f5, f6))
    {
        return Handle.BOTTOM;
    }
    if (b(f, f1, f2, f3, f5, f6))
    {
        return Handle.LEFT;
    }
    if (b(f, f1, f4, f3, f5, f6))
    {
        return Handle.RIGHT;
    }
    if (c(f, f1, f2, f3, f4, f5) && !a())
    {
        return Handle.CENTER;
    } else
    {
        return null;
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:46,代码来源:HandleUtil.java

示例4: getPressedHandle

/**
 * Determines which, if any, of the handles are pressed given the touch coordinates, the
 * bounding box, and the touch radius.
 *
 * @param x            the x-coordinate of the touch point
 * @param y            the y-coordinate of the touch point
 * @param left         the x-coordinate of the left bound
 * @param top          the y-coordinate of the top bound
 * @param right        the x-coordinate of the right bound
 * @param bottom       the y-coordinate of the bottom bound
 * @param targetRadius the target radius in pixels
 *
 * @return the Handle that was pressed; null if no Handle was pressed
 */
public static Handle getPressedHandle(float x,
                                      float y,
                                      float left,
                                      float top,
                                      float right,
                                      float bottom,
                                      float targetRadius) {

    // Find the closest corner handle to the touch point.
    // If the touch point is in the target zone of this closest handle, then this is the pressed handle.
    // Else, check if any of the edges are in the target zone of the touch point.
    // Else, check if the touch point is within the crop window bounds; if so, then choose the center handle.

    Handle closestHandle = null;
    float closestDistance = Float.POSITIVE_INFINITY;

    final float distanceToTopLeft = MathUtil.calculateDistance(x, y, left, top);
    if (distanceToTopLeft < closestDistance) {
        closestDistance = distanceToTopLeft;
        closestHandle = Handle.TOP_LEFT;
    }

    final float distanceToTopRight = MathUtil.calculateDistance(x, y, right, top);
    if (distanceToTopRight < closestDistance) {
        closestDistance = distanceToTopRight;
        closestHandle = Handle.TOP_RIGHT;
    }

    final float distanceToBottomLeft = MathUtil.calculateDistance(x, y, left, bottom);
    if (distanceToBottomLeft < closestDistance) {
        closestDistance = distanceToBottomLeft;
        closestHandle = Handle.BOTTOM_LEFT;
    }

    final float distanceToBottomRight = MathUtil.calculateDistance(x, y, right, bottom);
    if (distanceToBottomRight < closestDistance) {
        closestDistance = distanceToBottomRight;
        closestHandle = Handle.BOTTOM_RIGHT;
    }

    if (closestDistance <= targetRadius) {
        return closestHandle;
    }

    // If we get to this point, none of the corner handles were in the touch target zone, so then we check the edges.
    if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, top, targetRadius)) {
        return Handle.TOP;
    } else if (HandleUtil.isInHorizontalTargetZone(x, y, left, right, bottom, targetRadius)) {
        return Handle.BOTTOM;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, left, top, bottom, targetRadius)) {
        return Handle.LEFT;
    } else if (HandleUtil.isInVerticalTargetZone(x, y, right, top, bottom, targetRadius)) {
        return Handle.RIGHT;
    }

    // If we get to this point, none of the corners or edges are in the touch target zone.
    // Check to see if the touch point is within the bounds of the crop window. If so, choose the center handle.
    if (isWithinBounds(x, y, left, top, right, bottom)) {
        return Handle.CENTER;
    }

    return null;
}
 
开发者ID:edmodo,项目名称:cropper,代码行数:77,代码来源:HandleUtil.java


注:本文中的com.edmodo.cropper.cropwindow.handle.Handle.TOP_RIGHT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。