Skip to content

Commit

Permalink
v-max: factory reset & test
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Soquet authored and mkellner committed Feb 27, 2019
1 parent 94638dc commit f715e88
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tools/mcsim/ControlsPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,27 @@ export var ControlsColumn = Column.template($ => ({ left:0, right:0, top:0 }));
export var Button = Container.template($ => ({
width:80, height:30, skin:buttonSkin, active:true,
Behavior: class extends ButtonBehavior {
onCreate(container, data) {
super.onCreate(container, data);
if ("name" in data)
model.DEVICE.first.behavior[data.name] = container;
}
onTouchBegan(container, id, x, y, ticks) {
super.onTouchBegan(container, id, x, y, ticks);
let data = this.data;
if (data.eventDown)
model.DEVICE.first.delegate(data.eventDown, data);
}
onTouchEnded(container, id, x, y, ticks) {
super.onTouchEnded(container, id, x, y, ticks);
let data = this.data;
if (data.eventUp)
model.DEVICE.first.delegate(data.eventUp, data);
}
onTap(container) {
let data = this.data;
model.DEVICE.first.delegate(data.event, data);
if (data.event)
model.DEVICE.first.delegate(data.event, data);
}
},
contents: [
Expand Down
Binary file modified tools/mcsim/assets/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f715e88

Please sign in to comment.