layer.draggable.propagateEvents < boolean>

Set the propagateEvents property of a draggable layer. Set to true by default. This is useful when working with draggable layers within ScrollComponents or PageComponents, or nested Components.
Let's say you'd like to have a draggable layer within the scroll.content layer. By default, moving the layer will also move the scroll.content. This is because both layers will listen to the dragging events.
To prevent any draggable children from passing events to its parent, set propagateEvents to false. This applies to all nested draggable layers.
译:设置一个可拖动层的propagateEvents属性。默认设置为true。与ScrollComponents或PageComponents,或嵌套组件中拖动图层时,这是非常有用的。比方说,你想有scroll.content层内的可拖动层。默认情况下,移动层也将移动scroll.content。这是因为两个层将听取拖动事件。为了防止任何可拖动的子层从事件传递到其superLayer,设置propagateEvents为false。这适用于所有嵌套拖动图

scroll = new ScrollComponent
    width: Screen.width,
    height: Screen.height

scroll.content.backgroundColor = "#28affa"

layerA = new Layer
    parent: scroll.content,
    backgroundColor: "#fff"

layerA.draggable.enabled = true

# Setting propagateEvents to false allows you to drag layerA 
# without also scrolling within the ScrollComponent 
layerA.draggable.propagateEvents = false

results matching ""

    No results matching ""