小编Aud*_*dax的帖子

在使用轴心点进行画布缩放后,x和y坐标是错误的

我正在尝试在应该关注枢轴点的画布上实现缩放.缩放工作正常,但之后用户应该能够在画布上选择元素.问题是,我的翻译值似乎不正确,因为它们有不同的偏移,而不是我不缩放到枢轴点的那些(没有枢轴点的缩放和拖动工作正常).我使用了这个例子中的一些代码.

相关代码是:

class DragView extends View {

private static float MIN_ZOOM = 0.2f;
private static float MAX_ZOOM = 2f;

// These constants specify the mode that we're in
private static int NONE = 0;
private int mode = NONE;
private static int DRAG = 1;
private static int ZOOM = 2;
public ArrayList<ProcessElement> elements;

// Visualization
private boolean checkDisplay = false;
private float displayWidth;
private float displayHeight;
// These two variables keep track of the X and Y …
Run Code Online (Sandbox Code Playgroud)

android canvas zoom zooming pinchzoom

4
推荐指数
1
解决办法
2027
查看次数

标签 统计

android ×1

canvas ×1

pinchzoom ×1

zoom ×1

zooming ×1