Giter Club home page Giter Club logo

Comments (8)

kingslay avatar kingslay commented on May 24, 2024

you can override func panGestureBegan, panGestureChanged, panGestureEnded

   /// Add Customize functions here
    open func customizeUIComponents() {
        tapGesture.addTarget(self, action: #selector(onTapGestureTapped(_:)))
        tapGesture.numberOfTapsRequired = 1
        addGestureRecognizer(tapGesture)
        panGesture.addTarget(self, action: #selector(panDirection(_:)))
        addGestureRecognizer(panGesture)
        doubleTapGesture.addTarget(self, action: #selector(doubleGestureAction))
        doubleTapGesture.numberOfTapsRequired = 2
        tapGesture.require(toFail: doubleTapGesture)
        addGestureRecognizer(doubleTapGesture)
    }

from ksplayer.

prikshitgupta avatar prikshitgupta commented on May 24, 2024

thank you, can you please look into my feature request?

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on May 24, 2024

Could you please give an example of how this works? I'm having problems getting swipe up and down to execute my own code.

from ksplayer.

kingslay avatar kingslay commented on May 24, 2024

i only has the tvos simulator. so i can't try the Gesture

from ksplayer.

UnknownCoder807 avatar UnknownCoder807 commented on May 24, 2024

There is an option to display an on-screen apple remote, complete with gestures.

Window->Show Apple Remote

in the simulator window.

from ksplayer.

prikshitgupta avatar prikshitgupta commented on May 24, 2024

You have to press opt key to use gestures

from ksplayer.

kingslay avatar kingslay commented on May 24, 2024

thank. i will try it.

from ksplayer.

kingslay avatar kingslay commented on May 24, 2024

you can override func doubleTapGestureAction, tapGestureAction, panGestureAction

 @objc open func doubleTapGestureAction() {
        toolBar.playButton.sendActions(for: .primaryActionTriggered)
        isMaskShow = true
    }

    @objc open func tapGestureAction(_: UITapGestureRecognizer) {
        if srtControl.view.isHidden {
            isMaskShow.toggle()
        } else {
            srtControl.view.isHidden = true
        }
    }

    @objc private func panGestureAction(_ pan: UIPanGestureRecognizer) {
        // 播放结束时,忽略手势,锁屏状态忽略手势
        guard !replayButton.isSelected, !isLock else { return }
        // 根据上次和本次移动的位置,算出一个速率的point
        let velocityPoint = pan.velocity(in: self)
        switch pan.state {
        case .began:
            // 使用绝对值来判断移动的方向
            if abs(velocityPoint.x) > abs(velocityPoint.y) {
                scrollDirection = .horizontal
            } else {
                scrollDirection = .vertical
            }
            panGestureBegan(location: pan.location(in: self), direction: scrollDirection)
        case .changed:
            panGestureChanged(velocity: velocityPoint, direction: scrollDirection)
        case .ended:
            panGestureEnded()
        default:
            break
        }
    }

from ksplayer.

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.