Created
September 7, 2014 21:02
-
-
Save ohookins/37e8dc49e12ffd71742d to your computer and use it in GitHub Desktop.
Failed attempt at automatically adjusting content surface
This file contains 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
// Constructor function for our ContentView class | |
function ContentView() { | |
// Applies View's constructor function to ContentView class | |
View.apply(this, arguments); | |
var content = TextData['mycontent']; | |
// Backgrounds | |
this.add(new Surface({ | |
size: [undefined, undefined], | |
classes: ['black-bg'] | |
})); | |
this.add(new StateModifier({ | |
origin: [0.5, 0.5] | |
})).add(new Surface({ | |
size: [1024, undefined], | |
classes: ['grey-bg'] | |
})); | |
// Text | |
this.contentSurface = new Surface({ | |
size: [500, this.getSize()[1]-100], // <--- THIS FAILS | |
classes: ['grey-bg', 'scrollable'], | |
content: content, | |
properties: { | |
textAlign: 'center' | |
} | |
}); | |
// Center it in the content view | |
var centerModifier = new StateModifier({ | |
origin: [0.5, 0.5], | |
transform: Transform.translate(0, 100, 0) | |
}); | |
this.add(centerModifier).add(this.contentSurface); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment