RotateEvent
旋转事件,可用于旋转视图或图形。
- 移动端: 双指旋转
- 触摸板: 双指旋转(仅 Safari 支持)
事件名称
RotateEvent.START
开始旋转事件
rotate.start
RotateEvent.ROTATE
旋转事件
rotate
RotateEvent.END
结束旋转事件
rotate.end
关键属性
rotation: number
此次旋转事件改变的角度
继承
UIEvent
API
RotateEvent
示例
ts
import { Leafer, Rect, RotateEvent, LeafHelper } from 'leafer-ui'
const leafer = new Leafer({
view: window,
type: 'draw'
})
const rect = new Rect({ x: 100, y: 100, fill: '#32cd79', draggable: true })
leafer.add(rect)
leafer.on(RotateEvent.ROTATE, function (e: RotateEvent) {
const center = { x: e.x, y: e.y }
LeafHelper.rotateOfWorld(leafer, center, e.rotation)
})