mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-16 01:24:25 +02:00
all the way fixed
This commit is contained in:
parent
9206820a8d
commit
1ede0389ce
2 changed files with 29 additions and 8 deletions
|
@ -49,10 +49,9 @@ var Level = Sandbox.extend({
|
|||
|
||||
this.initGoalData(options);
|
||||
this.initName(options);
|
||||
this.on('toggleGoal', this.toggleGoal);
|
||||
this.on('minimizeCanvas', this.minimizeGoal);
|
||||
this.on('resizeCanvas', this.resizeGoal);
|
||||
this.on('toggleObjective', this.toggleObjective);
|
||||
this.isGoalExpanded = false;
|
||||
|
||||
Level.__super__.initialize.apply(this, [options]);
|
||||
this.startOffCommand();
|
||||
|
@ -60,6 +59,10 @@ var Level = Sandbox.extend({
|
|||
this.handleOpen(options.deferred);
|
||||
},
|
||||
|
||||
getIsGoalExpanded: function() {
|
||||
return this.isGoalExpanded;
|
||||
},
|
||||
|
||||
handleOpen: function(deferred) {
|
||||
deferred = deferred || Q.defer();
|
||||
|
||||
|
@ -132,10 +135,10 @@ var Level = Sandbox.extend({
|
|||
{
|
||||
name: name,
|
||||
onGoalClick: this.toggleGoal.bind(this),
|
||||
onObjectiveClick: this.toggleObjective.bind(this)
|
||||
onObjectiveClick: this.toggleObjective.bind(this),
|
||||
parent: this
|
||||
}
|
||||
);
|
||||
debugger;
|
||||
React.render(
|
||||
this.levelToolbar,
|
||||
document.getElementById('levelToolbarMount')
|
||||
|
@ -219,6 +222,8 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
minimizeGoal: function (position, size) {
|
||||
this.isGoalExpanded = false;
|
||||
this.trigger('goalToggled');
|
||||
this.goalVis.hide();
|
||||
this.goalWindowPos = position;
|
||||
this.goalWindowSize = size;
|
||||
|
@ -229,6 +234,9 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
resizeGoal: function () {
|
||||
if (!this.goalVis) {
|
||||
return;
|
||||
}
|
||||
this.goalVis.myResize();
|
||||
},
|
||||
|
||||
|
@ -290,6 +298,8 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
showGoal: function(command, defer) {
|
||||
this.isGoalExpanded = true;
|
||||
this.trigger('goalToggled');
|
||||
this.showSideVis(command, defer, this.goalCanvasHolder, this.initGoalVisualization);
|
||||
// show the squeezer again we are to the side
|
||||
if ($(this.goalVis.el).offset().left > 0.5 * $(window).width()) {
|
||||
|
@ -311,6 +321,8 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
hideGoal: function(command, defer) {
|
||||
this.isGoalExpanded = false;
|
||||
this.trigger('goalToggled');
|
||||
this.hideSideVis(command, defer, this.goalCanvasHolder);
|
||||
},
|
||||
|
||||
|
@ -487,7 +499,9 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
die: function() {
|
||||
this.levelToolbar.die();
|
||||
React.unmountComponentAtNode(
|
||||
document.getElementById('levelToolbarMount')
|
||||
);
|
||||
|
||||
this.hideGoal();
|
||||
this.mainVis.die();
|
||||
|
|
|
@ -9,12 +9,14 @@ var LevelToolbarView = React.createClass({
|
|||
propTypes: {
|
||||
name: PropTypes.string.isRequired,
|
||||
onGoalClick: PropTypes.func.isRequired,
|
||||
onObjectiveClick: PropTypes.func.isRequired
|
||||
onObjectiveClick: PropTypes.func.isRequired,
|
||||
parent: PropTypes.object.isRequired
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
isHidden: true
|
||||
isHidden: true,
|
||||
isGoalExpanded: false
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -22,6 +24,11 @@ var LevelToolbarView = React.createClass({
|
|||
this.setState({
|
||||
isHidden: false
|
||||
});
|
||||
this.props.parent.on('goalToggled', function() {
|
||||
this.setState({
|
||||
isGoalExpanded: this.props.parent.getIsGoalExpanded()
|
||||
});
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -49,7 +56,7 @@ var LevelToolbarView = React.createClass({
|
|||
<button
|
||||
onClick={this.props.onGoalClick}
|
||||
type="button">
|
||||
{false ?
|
||||
{this.state.isGoalExpanded ?
|
||||
intl.str('show-goal-button') :
|
||||
intl.str('hide-goal-button')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue