I'm trying to pipe mouse clicks from ScrollContainer
encapsulated in a view, but somehow nothing's happening. I've just started playing with Famo.us so maybe I'm missing something obvious here. I can pipe directly from surfaces contained within ScrollContainer
but I'm not sure if that's the way to do it. Any ideas ?
Link to runnable jsFiddle demo :
And the code itself :
define('main', function (require, exports, module) {
var Engine = require('famous/core/Engine');
var Surface = require('famous/core/Surface');
var Transform = require('famous/core/Transform');
var View = require('famous/core/View');
var Scrollview = require('famous/views/ScrollContainer');
var context = Engine.createContext();
var mainview = new View({
size: [500, 500]
});
var scrollview = new Scrollview({
scrollview: {direction:0, size: [undefined, 300]}
});
var surfaces = [];
scrollview.sequenceFrom(surfaces);
for (var i = 0; i < 40; i++) {
var surface = new Surface({
content: "Surface: " + (i + 1),
size: [undefined, 200],
properties: {
backgroundColor: "hsl(" + (i * 360 / 40) + ", 100%, 50%)",
lineHeight: "200px",
textAlign: "center"
}
});
surface.pipe(scrollview);
surfaces.push(surface);
}
mainview._eventInput.on('click', function(){
console.log('click');
});
scrollview.pipe(mainview);
mainview.add(scrollview);
context.add(mainview);
});