Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created June 11, 2010 08:15
Show Gist options
  • Save joegaudet/434234 to your computer and use it in GitHub Desktop.
Save joegaudet/434234 to your computer and use it in GitHub Desktop.
topToolbarDidChange: function() {
var active = this.activeTopToolbar, replacement = this.get("topToolbar");
// if we have an active toolbar, set the build direction and build out
if (active) {
if (this._currentDirection !== null) {
active.set("buildDirection", this._currentDirection);
this.buildOutChild(active);
} else {
this.removeChild(active);
}
}
// if we have a new toolbar, set the build direction and build in
if (replacement) {
if (this._currentDirection !== null) {
replacement.set("buildDirection", this._currentDirection);
this.buildInChild(replacement);
} else {
this.appendChild(replacement);
}
}
// update, and queue retiling
this.activeTopToolbar = replacement;
this.invokeOnce("childDidChange");
}.observes("topToolbar"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment