3

I'm using PhotoView library to create my custom MapView. It includes a path on it which the following code is draws:

protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.save();
        canvas.concat(getImageMatrix());
        canvas.drawPath(path, paint);
        canvas.restore();
    }

Also, I need to draw some pins with the same way and I need at least to zoom to a specific pin or area (which is being choosen by the user) and preferably with the animation.

I've tried to acheive this with the photoView.setScale(float scale, float x, float y, boolean animate) method, but x and y are coordinates of the visible part of bitmap that is being displayed and have 0,0 left-top coordinate even if there is displaying the center of the image. Please, help me to solve this problem.

Near1999
  • 1,547
  • 2
  • 18
  • 37
  • tried `setImageMatrix` ? – pskink Sep 20 '15 at 15:15
  • @pskink, yes, but I don't understand how to set translateX and translateY coordinates that I need (by x and y coordinates of the view). And when I'm setting it like this there is no animation ((( And I'm trying now to create method similar to setScale, but without result till now ( – Near1999 Sep 20 '15 at 15:50
  • So if I will draw some pin by the specific coordinates then I will create float[] matrix = new float[9], with [0] and [4] (scale) getMediumScale(), [2] xTranslate, [5] yTranslate. Which value I need to use in x and y translate to show my pin in the center or near it in the screen (if it is most extreme coordinate)? – Near1999 Sep 20 '15 at 17:06
  • read the `Matrix` API it has many methods to change the `Matrix` – pskink Sep 20 '15 at 17:12
  • @Near1999 - did you get any success on this? I also need the same functionality – SoftSan Jun 12 '17 at 17:41

0 Answers0