mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-30 09:44:26 +02:00
Issue #94 big graphics update to disable CSS hover and click event on HEAD when not detached
This commit is contained in:
parent
e2b2ced74a
commit
1c7d838262
5 changed files with 156 additions and 54 deletions
134
build/bundle.js
134
build/bundle.js
|
@ -16517,20 +16517,27 @@ var VisBranch = VisBase.extend({
|
||||||
opacity: this.getTextOpacity()
|
opacity: this.getTextOpacity()
|
||||||
});
|
});
|
||||||
this.set('text', text);
|
this.set('text', text);
|
||||||
|
var attr = this.getAttributes();
|
||||||
|
|
||||||
var rectPos = this.getRectPosition();
|
var rectPos = this.getRectPosition();
|
||||||
var sizeOfRect = this.getRectSize();
|
var sizeOfRect = this.getRectSize();
|
||||||
var rect = paper
|
var rect = paper
|
||||||
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
||||||
.attr(this.getAttributes().rect);
|
.attr(attr.rect);
|
||||||
this.set('rect', rect);
|
this.set('rect', rect);
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var arrow = paper
|
var arrow = paper
|
||||||
.path(arrowPath)
|
.path(arrowPath)
|
||||||
.attr(this.getAttributes().arrow);
|
.attr(attr.arrow);
|
||||||
this.set('arrow', arrow);
|
this.set('arrow', arrow);
|
||||||
|
|
||||||
|
// set CSS
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.attachClickHandlers();
|
this.attachClickHandlers();
|
||||||
rect.toFront();
|
rect.toFront();
|
||||||
text.toFront();
|
text.toFront();
|
||||||
|
@ -16540,16 +16547,30 @@ var VisBranch = VisBase.extend({
|
||||||
if (this.get('gitVisuals').options.noClick) {
|
if (this.get('gitVisuals').options.noClick) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
var objs = [
|
||||||
var Main = require('../app');
|
this.get('rect'),
|
||||||
var objs = [this.get('rect'), this.get('text'), this.get('arrow')];
|
this.get('text'),
|
||||||
|
this.get('arrow')
|
||||||
|
];
|
||||||
|
|
||||||
_.each(objs, function(rObj) {
|
_.each(objs, function(rObj) {
|
||||||
rObj.click(function() {
|
rObj.click(_.bind(this.onClick ,this));
|
||||||
|
//$(rObj.node).css('cursor', 'pointer');
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldDisableClick: function() {
|
||||||
|
return this.get('isHead') && !this.gitEngine.getDetachedHead();
|
||||||
|
},
|
||||||
|
|
||||||
|
onClick: function() {
|
||||||
|
if (this.shouldDisableClick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
||||||
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
||||||
});
|
|
||||||
$(rObj.node).css('cursor', 'pointer');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateName: function() {
|
updateName: function() {
|
||||||
|
@ -16583,8 +16604,14 @@ var VisBranch = VisBase.extend({
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var dashArray = (this.getIsRemote()) ? '--' : '';
|
var dashArray = (this.getIsRemote()) ? '--' : '';
|
||||||
|
var cursorStyle = (this.shouldDisableClick()) ?
|
||||||
|
'auto' :
|
||||||
|
'pointer';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
css: {
|
||||||
|
cursor: cursorStyle
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
x: textPos.x,
|
x: textPos.x,
|
||||||
y: textPos.y,
|
y: textPos.y,
|
||||||
|
@ -16622,20 +16649,28 @@ var VisBranch = VisBase.extend({
|
||||||
this.animateToAttr(toAttr, speed, easing);
|
this.animateToAttr(toAttr, speed, easing);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setAttr: function(attr, instant, speed, easing) {
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
if (instant) {
|
||||||
|
this.get(key).attr(attr[key]);
|
||||||
|
} else {
|
||||||
|
this.get(key).stop().animate(attr[key], speed, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
animateToAttr: function(attr, speed, easing) {
|
animateToAttr: function(attr, speed, easing) {
|
||||||
if (speed === 0) {
|
if (speed === 0) {
|
||||||
this.get('text').attr(attr.text);
|
this.setAttr(attr, /* instant */ true);
|
||||||
this.get('rect').attr(attr.rect);
|
|
||||||
this.get('arrow').attr(attr.arrow);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
||||||
var e = easing || this.get('animationEasing');
|
var e = easing || this.get('animationEasing');
|
||||||
|
this.setAttr(attr, /* instance */ false, s, e);
|
||||||
this.get('text').stop().animate(attr.text, s, e);
|
|
||||||
this.get('rect').stop().animate(attr.rect, s, e);
|
|
||||||
this.get('arrow').stop().animate(attr.arrow, s, e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32031,20 +32066,27 @@ var VisBranch = VisBase.extend({
|
||||||
opacity: this.getTextOpacity()
|
opacity: this.getTextOpacity()
|
||||||
});
|
});
|
||||||
this.set('text', text);
|
this.set('text', text);
|
||||||
|
var attr = this.getAttributes();
|
||||||
|
|
||||||
var rectPos = this.getRectPosition();
|
var rectPos = this.getRectPosition();
|
||||||
var sizeOfRect = this.getRectSize();
|
var sizeOfRect = this.getRectSize();
|
||||||
var rect = paper
|
var rect = paper
|
||||||
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
||||||
.attr(this.getAttributes().rect);
|
.attr(attr.rect);
|
||||||
this.set('rect', rect);
|
this.set('rect', rect);
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var arrow = paper
|
var arrow = paper
|
||||||
.path(arrowPath)
|
.path(arrowPath)
|
||||||
.attr(this.getAttributes().arrow);
|
.attr(attr.arrow);
|
||||||
this.set('arrow', arrow);
|
this.set('arrow', arrow);
|
||||||
|
|
||||||
|
// set CSS
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.attachClickHandlers();
|
this.attachClickHandlers();
|
||||||
rect.toFront();
|
rect.toFront();
|
||||||
text.toFront();
|
text.toFront();
|
||||||
|
@ -32054,16 +32096,30 @@ var VisBranch = VisBase.extend({
|
||||||
if (this.get('gitVisuals').options.noClick) {
|
if (this.get('gitVisuals').options.noClick) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
var objs = [
|
||||||
var Main = require('../app');
|
this.get('rect'),
|
||||||
var objs = [this.get('rect'), this.get('text'), this.get('arrow')];
|
this.get('text'),
|
||||||
|
this.get('arrow')
|
||||||
|
];
|
||||||
|
|
||||||
_.each(objs, function(rObj) {
|
_.each(objs, function(rObj) {
|
||||||
rObj.click(function() {
|
rObj.click(_.bind(this.onClick ,this));
|
||||||
|
//$(rObj.node).css('cursor', 'pointer');
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldDisableClick: function() {
|
||||||
|
return this.get('isHead') && !this.gitEngine.getDetachedHead();
|
||||||
|
},
|
||||||
|
|
||||||
|
onClick: function() {
|
||||||
|
if (this.shouldDisableClick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
||||||
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
||||||
});
|
|
||||||
$(rObj.node).css('cursor', 'pointer');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateName: function() {
|
updateName: function() {
|
||||||
|
@ -32097,8 +32153,14 @@ var VisBranch = VisBase.extend({
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var dashArray = (this.getIsRemote()) ? '--' : '';
|
var dashArray = (this.getIsRemote()) ? '--' : '';
|
||||||
|
var cursorStyle = (this.shouldDisableClick()) ?
|
||||||
|
'auto' :
|
||||||
|
'pointer';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
css: {
|
||||||
|
cursor: cursorStyle
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
x: textPos.x,
|
x: textPos.x,
|
||||||
y: textPos.y,
|
y: textPos.y,
|
||||||
|
@ -32136,20 +32198,28 @@ var VisBranch = VisBase.extend({
|
||||||
this.animateToAttr(toAttr, speed, easing);
|
this.animateToAttr(toAttr, speed, easing);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setAttr: function(attr, instant, speed, easing) {
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
if (instant) {
|
||||||
|
this.get(key).attr(attr[key]);
|
||||||
|
} else {
|
||||||
|
this.get(key).stop().animate(attr[key], speed, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
animateToAttr: function(attr, speed, easing) {
|
animateToAttr: function(attr, speed, easing) {
|
||||||
if (speed === 0) {
|
if (speed === 0) {
|
||||||
this.get('text').attr(attr.text);
|
this.setAttr(attr, /* instant */ true);
|
||||||
this.get('rect').attr(attr.rect);
|
|
||||||
this.get('arrow').attr(attr.arrow);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
||||||
var e = easing || this.get('animationEasing');
|
var e = easing || this.get('animationEasing');
|
||||||
|
this.setAttr(attr, /* instance */ false, s, e);
|
||||||
this.get('text').stop().animate(attr.text, s, e);
|
|
||||||
this.get('rect').stop().animate(attr.rect, s, e);
|
|
||||||
this.get('arrow').stop().animate(attr.arrow, s, e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -426,7 +426,7 @@
|
||||||
For a much easier time perusing the source, see the individual files at:
|
For a much easier time perusing the source, see the individual files at:
|
||||||
https://github.com/pcottle/learnGitBranching
|
https://github.com/pcottle/learnGitBranching
|
||||||
-->
|
-->
|
||||||
<script src="build/bundle.min.b384fc3e.js"></script>
|
<script src="build/bundle.js"></script>
|
||||||
|
|
||||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||||
The downside? No raw logs to parse for analytics, so I have to include
|
The downside? No raw logs to parse for analytics, so I have to include
|
||||||
|
|
|
@ -350,20 +350,27 @@ var VisBranch = VisBase.extend({
|
||||||
opacity: this.getTextOpacity()
|
opacity: this.getTextOpacity()
|
||||||
});
|
});
|
||||||
this.set('text', text);
|
this.set('text', text);
|
||||||
|
var attr = this.getAttributes();
|
||||||
|
|
||||||
var rectPos = this.getRectPosition();
|
var rectPos = this.getRectPosition();
|
||||||
var sizeOfRect = this.getRectSize();
|
var sizeOfRect = this.getRectSize();
|
||||||
var rect = paper
|
var rect = paper
|
||||||
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
.rect(rectPos.x, rectPos.y, sizeOfRect.w, sizeOfRect.h, 8)
|
||||||
.attr(this.getAttributes().rect);
|
.attr(attr.rect);
|
||||||
this.set('rect', rect);
|
this.set('rect', rect);
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var arrow = paper
|
var arrow = paper
|
||||||
.path(arrowPath)
|
.path(arrowPath)
|
||||||
.attr(this.getAttributes().arrow);
|
.attr(attr.arrow);
|
||||||
this.set('arrow', arrow);
|
this.set('arrow', arrow);
|
||||||
|
|
||||||
|
// set CSS
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.attachClickHandlers();
|
this.attachClickHandlers();
|
||||||
rect.toFront();
|
rect.toFront();
|
||||||
text.toFront();
|
text.toFront();
|
||||||
|
@ -373,16 +380,29 @@ var VisBranch = VisBase.extend({
|
||||||
if (this.get('gitVisuals').options.noClick) {
|
if (this.get('gitVisuals').options.noClick) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
var objs = [
|
||||||
var Main = require('../app');
|
this.get('rect'),
|
||||||
var objs = [this.get('rect'), this.get('text'), this.get('arrow')];
|
this.get('text'),
|
||||||
|
this.get('arrow')
|
||||||
|
];
|
||||||
|
|
||||||
_.each(objs, function(rObj) {
|
_.each(objs, function(rObj) {
|
||||||
rObj.click(function() {
|
rObj.click(_.bind(this.onClick ,this));
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldDisableClick: function() {
|
||||||
|
return this.get('isHead') && !this.gitEngine.getDetachedHead();
|
||||||
|
},
|
||||||
|
|
||||||
|
onClick: function() {
|
||||||
|
if (this.shouldDisableClick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var commandStr = 'git checkout ' + this.get('branch').get('id');
|
||||||
|
var Main = require('../app');
|
||||||
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
Main.getEventBaton().trigger('commandSubmitted', commandStr);
|
||||||
});
|
|
||||||
$(rObj.node).css('cursor', 'pointer');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
updateName: function() {
|
updateName: function() {
|
||||||
|
@ -416,8 +436,14 @@ var VisBranch = VisBase.extend({
|
||||||
|
|
||||||
var arrowPath = this.getArrowPath();
|
var arrowPath = this.getArrowPath();
|
||||||
var dashArray = (this.getIsRemote()) ? '--' : '';
|
var dashArray = (this.getIsRemote()) ? '--' : '';
|
||||||
|
var cursorStyle = (this.shouldDisableClick()) ?
|
||||||
|
'auto' :
|
||||||
|
'pointer';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
css: {
|
||||||
|
cursor: cursorStyle
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
x: textPos.x,
|
x: textPos.x,
|
||||||
y: textPos.y,
|
y: textPos.y,
|
||||||
|
@ -455,20 +481,28 @@ var VisBranch = VisBase.extend({
|
||||||
this.animateToAttr(toAttr, speed, easing);
|
this.animateToAttr(toAttr, speed, easing);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setAttr: function(attr, instant, speed, easing) {
|
||||||
|
var keys = ['text', 'rect', 'arrow'];
|
||||||
|
_.each(keys, function(key) {
|
||||||
|
if (instant) {
|
||||||
|
this.get(key).attr(attr[key]);
|
||||||
|
} else {
|
||||||
|
this.get(key).stop().animate(attr[key], speed, easing);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this.get(key).node).css(attr.css);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
animateToAttr: function(attr, speed, easing) {
|
animateToAttr: function(attr, speed, easing) {
|
||||||
if (speed === 0) {
|
if (speed === 0) {
|
||||||
this.get('text').attr(attr.text);
|
this.setAttr(attr, /* instant */ true);
|
||||||
this.get('rect').attr(attr.rect);
|
|
||||||
this.get('arrow').attr(attr.arrow);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
var s = speed !== undefined ? speed : this.get('animationSpeed');
|
||||||
var e = easing || this.get('animationEasing');
|
var e = easing || this.get('animationEasing');
|
||||||
|
this.setAttr(attr, /* instance */ false, s, e);
|
||||||
this.get('text').stop().animate(attr.text, s, e);
|
|
||||||
this.get('rect').stop().animate(attr.rect, s, e);
|
|
||||||
this.get('arrow').stop().animate(attr.arrow, s, e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue