日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)React教程:全景響應(yīng)器

PanResponder 將幾個(gè)觸發(fā)調(diào)節(jié)成一個(gè)單一的觸發(fā)動(dòng)作。該方法可以使單一觸發(fā)動(dòng)作對(duì)額外的觸發(fā)具有彈性,可以用來(lái)識(shí)別簡(jiǎn)單的多點(diǎn)觸發(fā)動(dòng)作。

鐘樓網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,鐘樓網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為鐘樓近千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的鐘樓做網(wǎng)站的公司定做!

它為響應(yīng)處理程序提供了一個(gè)可預(yù)測(cè)包,這個(gè)相應(yīng)處理程序是由動(dòng)作應(yīng)答系統(tǒng)提供的。對(duì)每一個(gè)處理程序,在正常事件旁提供了一個(gè)新的 gestureState 對(duì)象。 一個(gè) gestureState 對(duì)象有以下屬性:

  • stateID-gestureState 的ID-在屏幕上保持至少一個(gè)觸發(fā)動(dòng)作的時(shí)間

  • moveX-最近動(dòng)態(tài)觸發(fā)的最新的屏幕坐標(biāo)

  • x0-應(yīng)答器橫向的屏幕坐標(biāo)

  • y0-應(yīng)答器縱向的屏幕坐標(biāo)

  • dx-觸發(fā)開(kāi)始后累積的橫向動(dòng)作距離

  • dy-觸發(fā)開(kāi)始后累積的縱向動(dòng)作距離

  • vx-當(dāng)前手勢(shì)的橫向速度

  • vy-當(dāng)前手勢(shì)的縱向速度

  • numberActiveTouch-屏幕上當(dāng)前觸發(fā)的數(shù)量

基本用法

    componentWillMount: function() {        
this._panGesture = PanResponder.create({          // Ask to be the responder:          onStartShouldSetPanResponder: (evt, gestureState) => true,          onStartShouldSetPanResponderCapture: (evt, gestureState) => true,          onMoveShouldSetPanResponder: (evt, gestureState) => true,          onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,          onPanResponderGrant: (evt, gestureState) => {            // The guesture has started. Show visual feedback so the user knows            // what is happening!            // gestureState.{x,y}0 will be set to zero now
          },          onPanResponderMove: (evt, gestureState) => {            // The most recent move distance is gestureState.move{X,Y}            // The accumulated gesture distance since becoming responder is
           // gestureState.d{x,y}
          },          onResponderTerminationRequest: (evt, gestureState) => true,          onPanResponderRelease: (evt, gestureState) => {            // The user has released all touches while this view is the            // responder. This typically means a gesture has succeeded
          },          onPanResponderTerminate: (evt, gestureState) => {            // Another component has become the responder, so this gesture            // should be cancelled
          },
        });
      },      render: function() {        return (
         
        );
      },

工程實(shí)例

想要查看它的實(shí)際應(yīng)用,嘗試 PanResponder example in UIExplorer。

方法

static create(config: object)

@param {object} 所有應(yīng)答器回調(diào)配置的增強(qiáng)版本,應(yīng)答器回調(diào)不僅可以提供典型的 ResponderSyntheticEvent,還可以提供 PanResponder 動(dòng)作狀態(tài)。在每一個(gè)典型的 onResponder* 回調(diào)中,用 PanResponder 對(duì) Responder 做簡(jiǎn)單的替換。例如, config對(duì)象可能看起來(lái)像如下形式:

  • onMoveShouldSetPanResponder: (e, gestureState) => {...}

  • onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}

  • onStartShouldSetPanResponder: (e, gestureState) => {...}

  • onStartShouldSetPanResponderCapture: (e, gestureState) => {...}

  • onPanResponderReject: (e, gestureState) => {...}

  • onPanResponderGrant: (e, gestureState) => {...}

  • onPanResponderStart: (e, gestureState) => {...}

  • onPanResponderEnd: (e, gestureState) => {...}

  • onPanResponderRelease: (e, gestureState) => {...}

  • onPanResponderMove: (e, gestureState) => {...}

  • onPanResponderTerminate: (e, gestureState) => {...}

  • onPanResponderTerminationRequest: (e, gestureState) => {...}

一般來(lái)說(shuō),對(duì)于那些捕獲的等價(jià)事件,我們?cè)诓东@階段更新一次 gestureState ,并且也可以在冒泡階段使用。

在 onStartShould* 回調(diào)時(shí)需要注意一點(diǎn)。在對(duì)節(jié)點(diǎn)的捕獲/冒泡階段的開(kāi)始/結(jié)束事件中,它們只對(duì)更新后的gestureState 做出反應(yīng)。一旦節(jié)點(diǎn)成為應(yīng)答器,你可以依靠每一個(gè)被動(dòng)作和 gestureState 處理后相應(yīng)更新的開(kāi)始/結(jié)束事件。 (numberActiveTouches) 可能不完全準(zhǔn)確,除非你是應(yīng)答器。


本文名稱:創(chuàng)新互聯(lián)React教程:全景響應(yīng)器
網(wǎng)頁(yè)地址:http://www.dlmjj.cn/article/coesgij.html