Created
June 25, 2014 14:51
-
-
Save bingomanatee/c9c9209d4be34f2a21ae to your computer and use it in GitHub Desktop.
surfacs sizing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals define */ | |
define(function (require, exports, module) { | |
'use strict'; | |
var View = require('famous/core/View'); | |
var Surface = require('famous/core/Surface'); | |
var Modifier = require('famous/core/Modifier'); | |
var Transform = require('famous/core/Transform'); | |
var TTransform = require('famous/transitions/TransitionableTransform'); | |
var Easing = require('famous/transitions/Easing'); | |
var RenderNode = require('famous/core/RenderNode'); | |
var windowWatcher = require('./../windowWatcher'); | |
var FlexibleLayout = require('famous/views/FlexibleLayout'); | |
function UserPanel(main) { | |
this.main = main; | |
FlexibleLayout.call(this, {direction: 1, size: [true, undefined]}); | |
this.TwitterSurface = new Surface({content: '<section class="inner"><h2>Twitter</h2></section>', classes: ['option-panel']}); | |
this.FacebookSurface = new Surface({content: '<section class="inner"><h2>Facebook</h2></section>', classes: ['option-panel']}); | |
this.EYFSurface = new Surface({content: '<section class="inner"><h2>Eat Your Friends</h2></section>', classes: ['option-panel']}); | |
this.sequenceFrom([ this.TwitterSurface, this.FacebookSurface, this.EYFSurface]); | |
windowWatcher.onResize(this.sizePanels.bind(this)); | |
this.TwitterSurface.on('commit', function(){ | |
setTimeout(function(){ | |
this.sizePanels(); | |
}.bind(this), 0); | |
}.bind(this)); | |
} | |
UserPanel.prototype = Object.create(FlexibleLayout.prototype); | |
UserPanel.prototype.sizePanels = function (size) { | |
console.log('resizing twitter: ', this.TwitterSurface); | |
var ct = this._currTarget; | |
if (this.TwitterSurface._currTarget) { | |
var height = this.TwitterSurface._currTarget.clientHeight; | |
height -= 20; | |
var inner = this.TwitterSurface._currTarget.querySelector('.inner'); | |
inner.style.height = height + 'px'; | |
} | |
} | |
module.exports = UserPanel; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment