Skip to content

Commit 1f87d41

Browse files
authored
Merge pull request #46 from yapplabs/bug/detector-pane
Improve hammer handling in <VerticalPanDetectorPane> in dummy app
2 parents 2d52b7c + d7002be commit 1f87d41

File tree

1 file changed

+13
-5
lines changed
  • tests/dummy/app/components/vertical-pan-detector-pane

1 file changed

+13
-5
lines changed

tests/dummy/app/components/vertical-pan-detector-pane/component.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,32 @@ export default class VerticalPanDetectorPane extends Component {
1313
@action
1414
setupHammer(el){
1515
this.element = el;
16-
let mc = this.mc = new Hammer.Manager(this.element, {
16+
let hammer = this.hammer = new Hammer.Manager(this.element, {
1717
inputClass: Hammer.TouchMouseInput,
1818
recognizers: [
1919
[Hammer.Pan]
2020
]
2121
});
22-
mc.get('pan').set({ direction: Hammer.DIRECTION_VERTICAL });
23-
mc.on("panup pandown", (ev) => {
22+
hammer.get('pan').set({ direction: Hammer.DIRECTION_VERTICAL });
23+
hammer.on("panup pandown", (ev) => {
2424
this.statusText = ev.type +" gesture detected";
2525
});
2626

2727
schedule('afterRender', this, () => {
28-
this.gesture.register(this, mc.get('pan'));
28+
this.gesture.register(this, hammer.get('pan'));
2929
});
3030
}
3131

3232
@action
3333
teardownHammer(){
34-
this.gesture.unregister(this, this.mc.get('pan'));
34+
this.gesture.unregister(this, this.hammer.get('pan'));
35+
}
36+
37+
preferRecognizer(recognizer) {
38+
this.hammer.get('pan').requireFailure(recognizer);
39+
}
40+
41+
stopPreferringRecognizer(recognizer) {
42+
this.hammer.get('pan').dropRequireFailure(recognizer);
3543
}
3644
}

0 commit comments

Comments
 (0)