I noticed some weird behaviour on the GenericSync class in Famo.us. If you add "mousedown"
event on a surface it just blocks GenericSync on the Engine. Just comment out the last line in the Fiddle to see the problem.
http://jsfiddle.net/ckhu1pvw/8/
define('main', function (require, exports, module) {
var Engine = require('famous/core/Engine');
var EventHandler = require('famous/core/EventHandler');
var Surface = require('famous/core/Surface');
var mainContext = Engine.createContext();
var surface = new Surface({
size: [400, 200],
content: "Drag on me",
properties: {
background: "red",
lineHeight: "200px",
textAlign: "center",
color: "white"
}
});
var eventHandler = new EventHandler();
surface.pipe(eventHandler);
mainContext.add(surface);
var GenericSync = require("famous/inputs/GenericSync");
var MouseSync = require("famous/inputs/MouseSync");
var TouchSync = require("famous/inputs/TouchSync");
var ScrollSync = require("famous/inputs/ScrollSync");
GenericSync.register({
mouse: MouseSync,
touch: TouchSync,
scroll: ScrollSync
});
var sync = new GenericSync();
sync.addSync(["mouse", "touch", "scroll"]);
sync.on("start", function (event) {
console.log("SyncStart");
});
sync.on("update", function (event) {
surface.setContent(event.delta[0] + ", " + event.delta[1]);
});
sync.on("end", function (event) {
console.log("SyncEnd");
surface.setContent("0, 0");
});
Engine.pipe(sync);
// comment out this line to see the sync fail :(
//surface.on('mousedown', function(e) {console.log('The down of the mice');});
});
This is the last puzzle of a greater plan, so if you have a look please try to keep a similar structure (I mean please use sync on Engine). Any dirty hack is welcomed, I just lost hope in an elegant solution.
Thanks, Dave
update by David Szucs on 11.08.2014
What can I do to catch mousedown
event on the surface as well as trigger start
event on the global sync?