Code Monkey home page Code Monkey logo

Comments (6)

Mariovc avatar Mariovc commented on July 30, 2024

Quite simple:
Remove the lines 216-219:

        float scaleX = (float) viewWidth / (float) bmWidth;
        float scaleY = (float) viewHeight / (float) bmHeight;
        scale = Math.min(scaleX, scaleY);
        matrix.setScale(scale, scale);

and put them on a new method that is called between the lines 102-103 (only the first time).

if (xDiff < CLICK && yDiff < CLICK) {
      newMethod();
      performClick();
}

from touchimageview.

fantus8 avatar fantus8 commented on July 30, 2024

I did that and the following lines are giving error:

        float redundantYSpace = (float) viewHeight - (scale * (float) bmHeight) ;
        float redundantXSpace = (float) viewWidth - (scale * (float) bmWidth);
        redundantYSpace /= (float) 2 ;
        redundantXSpace /= (float) 2;

from touchimageview.

Mariovc avatar Mariovc commented on July 30, 2024

I suppose that is a NullPointerException. Put before those lines:
scale = 1;
to say that it is not scaled at the begining

from touchimageview.

fantus8 avatar fantus8 commented on July 30, 2024

Setting scale = 1 solved the problem but causes a new one. The image now only appears when I touch the screen and it floats at the bottom of the screen.

from touchimageview.

fantus8 avatar fantus8 commented on July 30, 2024

I solved the problem. Instead of removing lines 216-219, I kept them and added 2 lines of code:

        float scaleX = (float) viewWidth / (float) bmWidth;
        float scaleY = (float) viewHeight / (float) bmHeight;
        float scaleZ =1f;
        scale = Math.min(scaleX, scaleY);
        scale = Math.min(scale, scaleZ);
        matrix.setScale(scale, scale);

from touchimageview.

MikeOrtiz avatar MikeOrtiz commented on July 30, 2024

This issue will be fixed when scaleTypes are supported. You could then set the scale type to "center" in xml. Closed as another open issue deals with supporting scale types.

from touchimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.