ScrollComponent

A ScrollComponent is used to scroll content. It implements momentum and spring physics, allows for customization, and emits different events.

The ScrollComponent is built with two layers. The ScrollComponent itself is a layer that masks its content. It has a content layer that has draggable enabled and constraints configured. It automatically manages the size of the content layer based on the total size of the sub layers of the content layer.
译:一个scrollcomponent用于滚动内容。它实现了动量和弹簧物理,允许定制,并发出不同的事件。

scrollcomponent是用两层建的。scrollcomponent本身就是一层掩盖其内容。它有一个内容层,拖动启用和约束配置。它根据内容层的子层的总大小来自动管理内容层的大小。

# Create a new ScrollComponent 
scroll = new ScrollComponent
    width: 100
    height: 100

# Include a Layer 
layerA = new Layer
    parent: scroll.content

You can also wrap an existing layer within a ScrollComponent, using ScrollComponent.wrap(). The ScrollComponent will insert itself in-between the content and its super layer. This is useful when you've imported designs from Sketch or Photoshop and want to make a layer scrollable. You can learn more about wrapping in the learn section.
译:你也可以把现有的层内scrollcomponent,scrollcomponent wrap()使用。的scrollcomponent将在内容和超层之间。这是有用的当你导入的设计素描或PS图象处理软件想做一层滚动。你可以在学习部分了解更多关于包装的。

layerA = new Layer
    width: 300
    height: 300

scroll = ScrollComponent.wrap(layerA)

results matching ""

    No results matching ""