Skip to content

Improve responsive design #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions css/1140.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ img {
/* Smaller screens */

@media only screen and (max-width: 1023px) {

body {
font-size: 0.8em;
line-height: 1.5em;
}

}
/* font-size: 0.8em; */
line-height: 1.5em;
}
}


/* Mobile */
Expand Down
68 changes: 63 additions & 5 deletions css/explaingit.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ span.cmd {

#ExplainGitZen-Container .playground-container {
position: absolute;
top: 0;
bottom: 20px;
right: 20px;
left: 20px;
top: 10px;
bottom: 30px;
right: 30px;
left: 30px;
}

.remote-name-display {
Expand Down Expand Up @@ -168,7 +168,7 @@ span.cmd {
padding-left: 15px;
color: #FFF;
line-height: 14px;
background: url(../images/prompt.gif) no-repeat left top black;
background: url(../images/prompt.gif) no-repeat left center black;
}

.control-box input[type="text"] {
Expand Down Expand Up @@ -322,3 +322,61 @@ g.head-tag > text {
font-weight: bold;
text-transform: uppercase;
}

/* Mobile/portrait view */
@media screen and (max-width: 767px), (max-device-width: 1920px) and (orientation: portrait) {
.playground-container {
display: flex;
flex-flow: column;
}

.control-box {
position: relative;
width: 100%;
flex: 1 1 33%;
order: 1;
display: flex;
flex-flow: column;
overflow: hidden;
}

.control-box input {
width: calc(100% - 15px) !important;
font-size: 16px !important;
position: relative !important;
}

.control-box .log {
position: relative;
order: 2;
height: 100%;
top: 0;
bottom: 0;
}

.scenario-chooser {
position: relative !important;
left: 0 !important;
top: 0 !important;
}

.svg-container {
position: relative !important;
width: 100%;
flex: 1 1 33%;
left: 0 !important;
min-height: auto !important;
}
}

@media screen and (min-width: 540px) and (max-device-width: 1920px) and (orientation: portrait) {
body, .control-box .log, .control-box .log div {
font-size: 24px !important;
line-height: 2em !important;
}

.control-box input {
font-weight: bold;
font-size: 35px !important;
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</script>

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Visualizing Git</title>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/jquery-ui.min.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions js/controlbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,14 @@ function(_yargs, d3, demos) {
boolean: ['amend'],
string: ['m']
})
var msg = ""
this.transact(function() {
if (opts.amend) {
this.getRepoView().amendCommit(opts.m || this.getRepoView().getCommit('head').message)
} else {
this.getRepoView().commit(null, opts.m);
}
}, function(before, after) {
var reflogMsg = 'commit: ' + msg
var reflogMsg = 'commit: ' + (after.commit.message ?? '');
this.getRepoView().addReflogEntry(
'HEAD', after.commit.id, reflogMsg
)
Expand Down
6 changes: 4 additions & 2 deletions js/historyview.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ define(['d3'], function() {
this.currentBranch = config.currentBranch || 'master';

this.width = config.width;
this.height = config.height || 400;
this.height = 400;
this.orginalBaseLine = config.baseLine;
this.baseLine = this.height * (config.baseLine || 0.9);

Expand Down Expand Up @@ -528,7 +528,7 @@ define(['d3'], function() {

svg.attr('id', this.name)
.attr('width', this.width)
.attr('height', this.isRemote ? this.height + 150 : this.height);
.attr('height', this.height + 150);

if (this.isRemote) {
svg.append('svg:text')
Expand Down Expand Up @@ -603,12 +603,14 @@ define(['d3'], function() {
var perc = this.height.substring(0, this.height.length - 1) / 100.0;
var baseLineCalcHeight = Math.round(this.svg.node().parentNode.offsetHeight * perc) - 65;
var newBaseLine = Math.round(baseLineCalcHeight * (this.originalBaseLine || 0.6));

if (newBaseLine !== this.baseLine) {
this.baseLine = newBaseLine;
this.initialCommit.cy = newBaseLine;
this.svg.attr('height', baseLineCalcHeight);
}
}

this._calculatePositionData();
this._calculatePositionData(); // do this twice to make sure
this._renderCircles();
Expand Down