canvas = {
type: "canvas",
layout: $layout.fill,
events: {
draw: function (view, ctx) {
var centerX = view.frame.width * 0.5
var centerY = view.frame.height * 0.5
var radius = 72
var image
$photo.pick().then(function (resp) {
image = resp.image.resized($size(radius, radius))
rect = $rect(centerX - radius / 2, centerY - radius / 2, radius, radius)
ctx.addRect(rect)
ctx.drawImage(rect, image)
$ui.alert(image);
})
}
}
}
$ui.render({
props: {
debugging: true
},
views: [
canvas
]
})