Skip to content

Instantly share code, notes, and snippets.

@salimos
Created November 5, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salimos/7325548 to your computer and use it in GitHub Desktop.
Save salimos/7325548 to your computer and use it in GitHub Desktop.
import bb.cascades 1.0
Page {
property int x
property int y
Container {
id: container
layout: DockLayout {
}
TextField {
id: log
}
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
onTouch: {
x = 0
y = 0
log.text = "x = " + x + " et y = " + y
if (event.isMove()) {
x = event.localX
y = event.localY
var point = pen.createObject();
point.translationX = x
point.translationY = y
container.add(point);
}
}
attachedObjects: [
ComponentDefinition {
id: pen
Container {
layout: AbsoluteLayout {
}
ImageView {
id: couleur
imageSource: "asset:///maganta.png"
}
}
}
]
}
actions: [
ActionItem {
title: "Maganta"
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
couleur.imageSource = "asset:///maganta.png"
}
},
ActionItem {
title: "Rouge"
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
couleur.imageSource = "asset:///rouge.png"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment