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


Java WXEnvironment.sDefaultWidth方法代码示例

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


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

示例1: getRealPxByWidth

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
/**
 * Convert distance from JS,CSS to native. As the JS considers the width of the screen is 750px.
 * There must be a transform when accessing distance from JS,CSS and use it.
 * Basically, this method calculates a scale factor(ScreenWidth/750) and use apply this scale
 * factor to JS,CSS distance.
 * @param pxValue the raw distance from JS or CSS. The result will be rounded to a closet int.
 * @return the actual distance in the screen.
 */
public static float getRealPxByWidth(float pxValue) {
  if (Float.isNaN(pxValue)) {
    return pxValue;
  }
  if (mUseWebPx) {
    return (float) Math.rint(pxValue);
  } else {
    float realPx = (pxValue * getScreenWidth() / WXEnvironment.sDefaultWidth);
    return realPx > 0.005 && realPx < 1 ? 1 : (float) Math.rint(realPx);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXViewUtils.java

示例2: getRealSubPxByWidth

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
public static float getRealSubPxByWidth(float pxValue) {
  if (Float.isNaN(pxValue)) {
    return pxValue;
  }
  if (mUseWebPx) {
    return (float) Math.rint(pxValue);
  } else {
    float realPx = (pxValue * getScreenWidth() / WXEnvironment.sDefaultWidth);
    return realPx > 0.005 && realPx < 1 ? 1 : realPx;
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:12,代码来源:WXViewUtils.java

示例3: getWeexPxByReal

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
/**
 *  Internal interface that just for debug, you should never call this method because of accuracy loss obviously
 */
public static float getWeexPxByReal(float pxValue) {
  if (Float.isNaN(pxValue)) {
    return pxValue;
  }
  if (mUseWebPx) {
    return (float) Math.rint(pxValue);
  } else {
    return pxValue * WXEnvironment.sDefaultWidth / getScreenWidth();
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:14,代码来源:WXViewUtils.java

示例4: getRealPxByWidth2

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
public static int getRealPxByWidth2(float pxValue) {
  if (mUseWebPx) {
    return (int) pxValue;
  } else {
    float realPx = (pxValue * getScreenWidth() / WXEnvironment.sDefaultWidth);
    return realPx > 0.005 && realPx < 1 ? 1 : (int) realPx - 1;
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:9,代码来源:WXViewUtils.java

示例5: getWebPxByWidth

import com.taobao.weex.WXEnvironment; //导入方法依赖的package包/类
/**
 * Convert distance from native to JS,CSS. As the JS considers the width of the screen is 750px.
 * There must be a transform when return distance to JS,CSS.
 * Basically, this method calculates a scale factor(ScreenWidth/750) and use apply this scale
 * factor to native distance.
 * @param pxValue the raw distance of native. The result will be rounded to a closet int.
 * @return the distance in JS,CSS where the screenWidth is 750 px.
 */
public static float getWebPxByWidth(float pxValue) {
  if (pxValue < -1.9999 && pxValue > -2.005) {
    return Float.NaN;
  }
  if (mUseWebPx) {
    return pxValue;
  } else {
    float realPx = (pxValue * WXEnvironment.sDefaultWidth / getScreenWidth());
    return realPx > 0.005 && realPx < 1 ? 1 : realPx;
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXViewUtils.java


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