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


Java Viewport.set方法代码示例

本文整理汇总了Java中lecho.lib.hellocharts.model.Viewport.set方法的典型用法代码示例。如果您正苦于以下问题:Java Viewport.set方法的具体用法?Java Viewport.set怎么用?Java Viewport.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lecho.lib.hellocharts.model.Viewport的用法示例。


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

示例1: computeScrollViewport

import lecho.lib.hellocharts.model.Viewport; //导入方法依赖的package包/类
private Viewport computeScrollViewport(float x, float y) {
    Viewport maxViewport = getMaximumViewport();
    Viewport currentViewport = getCurrentViewport();
    Viewport scrollViewport = new Viewport(currentViewport);

    if (maxViewport.contains(x, y)) {
        final float width = currentViewport.width();
        final float height = currentViewport.height();

        final float halfWidth = width / 2;
        final float halfHeight = height / 2;

        float left = x - halfWidth;
        float top = y + halfHeight;

        left = Math.max(maxViewport.left, Math.min(left, maxViewport.right - width));
        top = Math.max(maxViewport.bottom + height, Math.min(top, maxViewport.top));

        scrollViewport.set(left, top, left + width, top - height);
    }

    return scrollViewport;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:AbstractChartView.java

示例2: computeScrollViewport

import lecho.lib.hellocharts.model.Viewport; //导入方法依赖的package包/类
private Viewport computeScrollViewport(float x, float y) {
    Viewport maxViewport = getMaximumViewport();
    Viewport currentViewport = getCurrentViewport();
    Viewport scrollViewport = new Viewport(currentViewport);
    if (maxViewport.contains(x, y)) {
        float width = currentViewport.width();
        float height = currentViewport.height();
        float top = y + (height / 2.0f);
        float left = Math.max(maxViewport.left, Math.min(x - (width / 2.0f), maxViewport.right - width));
        top = Math.max(maxViewport.bottom + height, Math.min(top, maxViewport.top));
        scrollViewport.set(left, top, left + height, top - height);
    }
    return scrollViewport;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:AbstractChartView.java

示例3: computeZoomViewport

import lecho.lib.hellocharts.model.Viewport; //导入方法依赖的package包/类
private Viewport computeZoomViewport(float x, float y, float zoomLevel) {
    final Viewport maxViewport = getMaximumViewport();
    Viewport zoomViewport = new Viewport(getMaximumViewport());

    if (maxViewport.contains(x, y)) {

        if (zoomLevel < 1) {
            zoomLevel = 1;
        } else if (zoomLevel > getMaxZoom()) {
            zoomLevel = getMaxZoom();
        }

        final float newWidth = zoomViewport.width() / zoomLevel;
        final float newHeight = zoomViewport.height() / zoomLevel;

        final float halfWidth = newWidth / 2;
        final float halfHeight = newHeight / 2;

        float left = x - halfWidth;
        float right = x + halfWidth;
        float top = y + halfHeight;
        float bottom = y - halfHeight;

        if (left < maxViewport.left) {
            left = maxViewport.left;
            right = left + newWidth;
        } else if (right > maxViewport.right) {
            right = maxViewport.right;
            left = right - newWidth;
        }

        if (top > maxViewport.top) {
            top = maxViewport.top;
            bottom = top - newHeight;
        } else if (bottom < maxViewport.bottom) {
            bottom = maxViewport.bottom;
            top = bottom + newHeight;
        }

        ZoomType zoomType = getZoomType();
        if (ZoomType.HORIZONTAL_AND_VERTICAL == zoomType) {
            zoomViewport.set(left, top, right, bottom);
        } else if (ZoomType.HORIZONTAL == zoomType) {
            zoomViewport.left = left;
            zoomViewport.right = right;
        } else if (ZoomType.VERTICAL == zoomType) {
            zoomViewport.top = top;
            zoomViewport.bottom = bottom;
        }

    }
    return zoomViewport;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:54,代码来源:AbstractChartView.java

示例4: computeZoomViewport

import lecho.lib.hellocharts.model.Viewport; //导入方法依赖的package包/类
private Viewport computeZoomViewport(float x, float y, float zoomLevel) {
    Viewport maxViewport = getMaximumViewport();
    Viewport zoomViewport = new Viewport(getMaximumViewport());
    if (maxViewport.contains(x, y)) {
        if (zoomLevel < 1.0f) {
            zoomLevel = 1.0f;
        } else if (zoomLevel > getMaxZoom()) {
            zoomLevel = getMaxZoom();
        }
        float newWidth = zoomViewport.width() / zoomLevel;
        float newHeight = zoomViewport.height() / zoomLevel;
        float halfWidth = newWidth / 2.0f;
        float halfHeight = newHeight / 2.0f;
        float left = x - halfWidth;
        float right = x + halfWidth;
        float top = y + halfHeight;
        float bottom = y - halfHeight;
        if (left < maxViewport.left) {
            left = maxViewport.left;
            right = left + newWidth;
        } else if (right > maxViewport.right) {
            right = maxViewport.right;
            left = right - newWidth;
        }
        if (top > maxViewport.top) {
            top = maxViewport.top;
            bottom = top - newHeight;
        } else if (bottom < maxViewport.bottom) {
            bottom = maxViewport.bottom;
            top = bottom + newHeight;
        }
        ZoomType zoomType = getZoomType();
        if (ZoomType.HORIZONTAL_AND_VERTICAL == zoomType) {
            zoomViewport.set(left, top, right, bottom);
        } else if (ZoomType.HORIZONTAL == zoomType) {
            zoomViewport.left = left;
            zoomViewport.right = right;
        } else if (ZoomType.VERTICAL == zoomType) {
            zoomViewport.top = top;
            zoomViewport.bottom = bottom;
        }
    }
    return zoomViewport;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:45,代码来源:AbstractChartView.java


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