scroll.closestContentLayer(originX, originY)

Get the layer closest to the ScrollComponent, depending on the defined origin. The origin is defined as numbers between 0 and 1, where (0,0) is the top-left corner, (0.5, 0.5) the center, and (1,1)the bottom-right corner.

The default values are (0,0). This means that it calculates the distance from the top-left of the ScrollComponent to the top-left of the content layers.
译:得到的最接近scrollcomponent层,根据定义的起源。原点是定义为数字01之间的,(0,0)是左上角,(0.5,0.5)是中心,和(1,1)是右下角。

默认值是(0,0)。这意味着计算距离的scrollcomponent左上到内容层的左上方。

scroll = new ScrollComponent

# Create content layers 
layerA = new Layer
    parent: scroll.content
    name: "layerA"
    x: 0
    y: 0

layerB = new Layer
    parent: scroll.content
    name: "layerB"
    x: 50
    y: 50

# Get the Layer of which the center point is closest 
# to the center point of the ScrollComponent 
print scroll.closestContentLayer(0.5, 0.5)

results matching ""

    No results matching ""