Giter Club home page Giter Club logo

Comments (5)

bubble96 avatar bubble96 commented on May 19, 2024

@jenly1314大大有空吗?

from zxinglite.

jenly1314 avatar jenly1314 commented on May 19, 2024

不需要。不太清楚你代码怎么写的。

  1. 实现缩放需了解其原理就比较容易去实现,缩放的本质都是通过事件触发变焦
    camera.getParameters().setZoom(int zoom); 达到想要达到效果。
  2. 源生zxing并不好用,用户体验很不好,所以才会出现各种基于zxing的衍生库。

from zxinglite.

bubble96 avatar bubble96 commented on May 19, 2024

嗯,项目需要,现集成的是QRcode的库,需求要求加上手指缩放,我一开始想的是在CaputureActivity重写onTouchEvent,然后在判定双指的时候,进行缩放,但是断点显示事件没触发,所以一直不知道该怎么去修改,望大大指点,可以贴出代码

from zxinglite.

jenly1314 avatar jenly1314 commented on May 19, 2024

onTouchEvent中的主要逻辑如下:

 switch (event.getAction() & MotionEvent.ACTION_MASK) {//TODO: 多点触控
            case MotionEvent.ACTION_POINTER_DOWN:
                //TODO: 多点触摸按下时事件。此处记录手指按下时初始距离逻辑

                break;
            case MotionEvent.ACTION_MOVE:
                //TODO: 移动时事件。计算出移动时手指距离与上一次移动时手指距离进行对比(初次移动的上一次距离为手指按下时初始距离),如果移动距离远了则放大变焦,反之则缩小变焦。

                break;
        }

具体示例可参见:CaptureActivity中的onTouchEvent方法。

from zxinglite.

bubble96 avatar bubble96 commented on May 19, 2024

谢谢大大解答,我重写的onTouchEvent事件是差不多的,现在困扰我的是这个事件没有触发,然后我一直找不到原因,但是看大大写的就能触发,所以在想是代码哪里不一样,还是我欠缺哪个地方没写,所以重写的事件无法被触发

from zxinglite.

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.