mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 23:48:34 +02:00
fixed long text in dmeonstarton view
This commit is contained in:
parent
f19f080d61
commit
0c4319911e
6 changed files with 291 additions and 18 deletions
|
@ -52,6 +52,7 @@ var GitDemonstrationView = ContainedBase.extend({
|
|||
title: options.title || 'Git Demonstration'
|
||||
});
|
||||
this.render();
|
||||
this.checkScroll();
|
||||
|
||||
this.navEvents = _.clone(Backbone.Events);
|
||||
this.navEvents.on('positive', this.positive, this);
|
||||
|
@ -74,6 +75,31 @@ var GitDemonstrationView = ContainedBase.extend({
|
|||
}
|
||||
},
|
||||
|
||||
checkScroll: function() {
|
||||
console.log('checking scroll');
|
||||
var children = this.$('div.demonstrationText').children();
|
||||
var heights = _.map(children, function(child) { return child.clientHeight; });
|
||||
var totalHeight = _.reduce(heights, function(a, b) { return a + b; });
|
||||
console.log(children, heights, totalHeight);
|
||||
if (totalHeight < this.$('div.demonstrationText').height()) {
|
||||
this.$('div.demonstrationText').addClass('noLongText');
|
||||
}
|
||||
},
|
||||
|
||||
dispatchBeforeCommand: function() {
|
||||
if (!this.options.beforeCommand) {
|
||||
return;
|
||||
}
|
||||
// here we just split the command and push them through to the git engine
|
||||
util.splitTextCommand(this.options.beforeCommand, function(commandStr) {
|
||||
this.mainVis.gitEngine.dispatch(new Command({
|
||||
rawStr: commandStr
|
||||
}), Q.defer());
|
||||
}, this);
|
||||
// then harsh refresh
|
||||
this.mainVis.gitVisuals.refreshTreeHarsh();
|
||||
},
|
||||
|
||||
takeControl: function() {
|
||||
this.hasControl = true;
|
||||
this.keyboardListener.listen();
|
||||
|
@ -193,6 +219,7 @@ var GitDemonstrationView = ContainedBase.extend({
|
|||
});
|
||||
this.mainVis.customEvents.on('paperReady', _.bind(function() {
|
||||
this.visFinished = true;
|
||||
this.dispatchBeforeCommand();
|
||||
if (this.shown) {
|
||||
// show the canvas once its done if we are shown
|
||||
this.show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue