Skip to content

Instantly share code, notes, and snippets.

@cj3kim
Created April 23, 2014 20:11
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 cj3kim/11230574 to your computer and use it in GitHub Desktop.
Save cj3kim/11230574 to your computer and use it in GitHub Desktop.
ScrollContainer bug?
function ScrollContainer(options) {
this.options = Object.create(ScrollContainer.DEFAULT_OPTIONS);
this._optionsManager = new OptionsManager(this.options);
if (options) this.setOptions(options);
this.container = new ContainerSurface(this.options.container);
this.scrollview = new Scrollview(this.options.scrollview);
this.surface.add(this.scrollview);
EventHandler.setInputHandler(this, this.scrollview);
EventHandler.setOutputHandler(this, this.scrollview);
this.scrollview.subscribe(this.container);
}
ScrollContainer.DEFAULT_OPTIONS = {
container: {
properties: {overflow : 'hidden'}
},
scrollview: {direction: Utility.Direction.X}
};
@cj3kim
Copy link
Author

cj3kim commented Apr 23, 2014

require("./famous-polyfills/index");

require('domready')(function () {
var Engine = require('./famous/core/Engine');
var InputSurface = require('./famous/surfaces/InputSurface');
var StateModifier = require('./famous/modifiers/StateModifier');
var ContainerSurface = require('./famous/surfaces/ContainerSurface');
var ScrollContainer = require('./famous/views/ScrollContainer');

// create the main context
var mainContext = Engine.createContext();

var wrapper = new ContainerSurface({
size: [undefined, undefined],
});

var chatWrapper = new ContainerSurface({
size: [false, undefined],
properties: {
width: '80%',
backgroundColor: 'blue'
}
});

var chatDisplay = new ScrollContainer({
size: [undefined, false],
properties: {
height: '80%',
backgroundColor: 'red'
},
surface: undefined
});

var chatMessages = [];
chatDisplay.sequenceFrom(chatMessages);

var chatInput = new InputSurface({
size: [undefined, false],
properties: {
height: '20%',
backgroundColor: 'yellow'
}
});

chatWrapper.add(chatDisplay);
chatWrapper.add(chatInput);
wrapper.add(chatWrapper)

mainContext.add(wrapper);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment