add draggable in js & android

This commit is contained in:
王劲鹏
2020-01-02 20:02:21 +08:00
committed by osborn
parent a6419e0fdf
commit ece2e0cac2
7 changed files with 207 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
import { Panel, Group, vlayout, layoutConfig, draggable, Color, Text} from "doric";
import { title } from "./utils";
@Entry
class DraggableDemo extends Panel {
build(root: Group) {
let text = (new Text).also(it => {
it.layoutConfig = layoutConfig().most()
it.textColor = Color.parse('#ff0000')
})
vlayout([
title("Draggable Demo"),
draggable({
onDrag: (x: number, y: number) => {
text.text = "x: " + x + " y: " + y
}
}, [ text ]).apply({
layoutConfig: layoutConfig().just(),
width: 100,
height: 100,
backgroundColor: Color.WHITE
})
])
.apply({
layoutConfig: layoutConfig().most(),
backgroundColor: Color.BLACK
})
.in(root)
}
}