2014-09-02 3 views
0

여러 개의 하위 행이있는 대형 상위 계층이 있습니다. 부모가 세로로 드래그되는 동안 행이 가로로 드래그되는 것을 방지하고 싶습니다. 내 생각 엔 draggable = falseTouchStart에 올려야했지만 운이 없었습니다.부모를 드래그하는 동안 하위 레이어에서 끌기를 끄려면 어떻게해야합니까?

cellHeight = 170 
cellWidth = 640 
rows = 3 

container = new Layer 
container.draggable = true 
container.draggable.speedX = 0 
container.width = cellWidth 
container.height = cellHeight * rows 
container.on Events.TouchMove, -> 
    myLayer.draggable = false 

container.on Events.TouchEnd, -> 
    container.animate 
     properties: 
      y: 0 
     curve: "spring(500, 40, 20)" 


for row in [0..rows-1] 
    myLayer = new Layer 
     x: 0 
     y: cellHeight*row 
     width: cellWidth 
     height: cellHeight 
     backgroundColor: "#FFF" 
    myLayer.superLayer = container 
    myLayer.style = 
     borderBottom: "1px solid black" 
    myLayer.draggable = true 
    myLayer.draggable.speedY = 0 
    myLayer.on Events.TouchStart, -> 
     container.draggable = false 

    myLayer.on Events.TouchEnd, (event, touchedLayer) -> 
     container.draggable = true 
     touchedLayer.animate 
      properties: 
       x: 0 
      curve: "spring(700, 40, 20)" 

답변

0

귀하의 스크립트를 테스트했습니다. 자녀를 드래그하는 동안 부모 이동을 막으려 고하고 있습니까? for 루프에서 시도해 볼 수 있습니다.

myLayer.on Events.DragMove, -> 
    container.draggable.enabled = false 
myLayer.on Events.DragEnd, -> 
    container.draggable.enabled = true