scroll.scrollToClosestLayer(originX, originY)

Scroll to the closest content layer, using the given origin. The default values are (0,0) which is the top-left corner, (0.5, 0.5) the center, and (1,1) the bottom-right corner.
译:滚动到最接近的内容层,使用给定的原点。默认值是(0,0)是左上角,(0.5,0.5)是中心,和(1,1)是右下角。

Arguments(参数)
  1. originX — A number between 0 and 1. 译:介于0和1之间的数字。
  2. originY — A number between 0 and 1. 译:介于0和1之间的数字。
scroll = new ScrollComponent

layerA = new Layer
    parent: scroll.content
    x: 75
    y: 75

# Scroll to the center of layerA 
scroll.scrollToClosestLayer(0.5, 0.5)

results matching ""

    No results matching ""