Skip to content

Frame

创建画板。默认白色背景、会裁剪掉超出宽高的内容,类似于 HTML5 中的一个页面。

关键属性

width: number

宽度。

height: number

高度。

fill: string | PaintPaint[]

默认白色背景。

overflow: IOverflow

如何显示超出宽高的内容,默认为 hide。

ts
type IOverflow = 'show' | 'hide'

继承

Box

API

Frame

示例

创建画板

ts
import { Leafer, Frame, Ellipse } from 'leafer-ui'

const leafer = new Leafer({ view: window, fill: 'gray' })

const frame = new Frame({ 
    width: 100,
    height: 100
})

const rect = new Ellipse({
    x: 60,
    y: 60,
    width: 50,
    height: 50,
    fill: '#32cd79',
    draggable: true
})

leafer.add(frame)
frame.add(rect)

Released under the MIT License.