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


Java ScaleGestureDetector.getCurrentSpanY方法代码示例

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


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

示例1: onScale

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public boolean onScale(ScaleGestureDetector detector) {
    RectF rect = mCropWindowHandler.getRect();

    float x = detector.getFocusX();
    float y = detector.getFocusY();
    float dY = detector.getCurrentSpanY() / 2;
    float dX = detector.getCurrentSpanX() / 2;

    float newTop = y - dY;
    float newLeft = x - dX;
    float newRight = x + dX;
    float newBottom = y + dY;

    if (newLeft < newRight &&
            newTop <= newBottom &&
            newLeft >= 0 &&
            newRight <= mCropWindowHandler.getMaxCropWidth() &&
            newTop >= 0 &&
            newBottom <= mCropWindowHandler.getMaxCropHeight()) {

        rect.set(newLeft, newTop, newRight, newBottom);
        mCropWindowHandler.setRect(rect);
        invalidate();
    }

    return true;
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:30,代码来源:CropOverlayView.java

示例2: onScale

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public boolean onScale(ScaleGestureDetector detector) {
  RectF rect = mCropWindowHandler.getRect();

  float x = detector.getFocusX();
  float y = detector.getFocusY();
  float dY = detector.getCurrentSpanY() / 2;
  float dX = detector.getCurrentSpanX() / 2;

  float newTop = y - dY;
  float newLeft = x - dX;
  float newRight = x + dX;
  float newBottom = y + dY;

  if (newLeft < newRight
      && newTop <= newBottom
      && newLeft >= 0
      && newRight <= mCropWindowHandler.getMaxCropWidth()
      && newTop >= 0
      && newBottom <= mCropWindowHandler.getMaxCropHeight()) {

    rect.set(newLeft, newTop, newRight, newBottom);
    mCropWindowHandler.setRect(rect);
    invalidate();
  }

  return true;
}
 
开发者ID:prashantsaini1,项目名称:android-titanium-imagecropper,代码行数:30,代码来源:CropOverlayView.java

示例3: getCurrentSpanY

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
/**
 * @see ScaleGestureDetector#getCurrentSpanY()
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static float getCurrentSpanY(ScaleGestureDetector scaleGestureDetector) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return scaleGestureDetector.getCurrentSpanY();
    } else {
        return scaleGestureDetector.getCurrentSpan();
    }
}
 
开发者ID:donglua,项目名称:JZAndroidChart,代码行数:12,代码来源:ScaleGestureDetectorCompat.java

示例4: onScale

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
@Override
public boolean onScale(ScaleGestureDetector detector) {
	if(source != null) {
		// Zoom horizontal if focus in the main area or always if decoupled axis is deactivated:
		if(!decoupledAxis || detector.getFocusX() > getGridSize()*1.5) {
			float xScale = detector.getCurrentSpanX() / detector.getPreviousSpanX();
			long frequencyFocus = virtualFrequency + (int) ((detector.getFocusX() / width - 0.5) * virtualSampleRate);
			int maxSampleRate = demodulationEnabled ? (int) (source.getSampleRate() * 0.9) : source.getMaxSampleRate();
			if(recordingEnabled)
				maxSampleRate = source.getSampleRate();
			virtualSampleRate = (int) Math.min(Math.max(virtualSampleRate / xScale, MIN_VIRTUAL_SAMPLERATE), maxSampleRate);
			virtualFrequency = Math.min(Math.max(frequencyFocus + (long) ((virtualFrequency - frequencyFocus) / xScale),
					source.getMinFrequency() - source.getSampleRate() / 2), source.getMaxFrequency() + source.getSampleRate() / 2);

			// if we zoomed the channel selector out of the window, reset the channel selector:
			if (demodulationEnabled && channelFrequency < virtualFrequency - virtualSampleRate / 2) {
				channelFrequency = virtualFrequency - virtualSampleRate / 2;
				rfControlInterface.updateChannelFrequency(channelFrequency);
			}
			if (demodulationEnabled && channelFrequency > virtualFrequency + virtualSampleRate / 2) {
				channelFrequency = virtualFrequency + virtualSampleRate / 2;
				rfControlInterface.updateChannelFrequency(channelFrequency);
			}
		}

		// Zoom vertical if enabled and focus in the left grid area or if decoupled axis is deactivated:
		if (verticalZoomEnabled && (!decoupledAxis || detector.getFocusX() <= getGridSize() * 1.5)) {
			float yScale = detector.getCurrentSpanY() / detector.getPreviousSpanY();
			float dBFocus = maxDB - (maxDB - minDB) * (detector.getFocusY() / getFftHeight());
			float newMinDB = Math.min(Math.max(dBFocus - (dBFocus - minDB) / yScale, MIN_DB), MAX_DB - 10);
			float newMaxDB = Math.min(Math.max(dBFocus - (dBFocus - maxDB) / yScale, newMinDB + 10), MAX_DB);
			this.setDBScale(newMinDB, newMaxDB);

			// adjust the squelch if it is outside the visible viewport right now:
			if(squelch < minDB)
				squelch = minDB;
			if(squelch > maxDB)
				squelch = maxDB;
		}

		// Automatically re-adjust the sample rate of the source if we zoom too far out or in
		// (only if not recording or demodulating!)
		if(!recordingEnabled && !demodulationEnabled) {
			if (source.getSampleRate() < virtualSampleRate && virtualSampleRate < source.getMaxSampleRate())
				source.setSampleRate(source.getNextHigherOptimalSampleRate(virtualSampleRate));
			int nextLower = source.getNextLowerOptimalSampleRate(source.getSampleRate());
			if ((virtualSampleRate < nextLower) && (source.getSampleRate() > nextLower)) {
				source.setSampleRate(nextLower);
			}
		}
	}
	return true;
}
 
开发者ID:takyonxxx,项目名称:AndroidSdrRtlTuner,代码行数:54,代码来源:AnalyzerSurface.java


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