Skip to content

Commit

Permalink
Tweak reduction toolbar for phone (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed May 6, 2018
1 parent 5346c3a commit 8cc435e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
button, #nav > a {
font-family: inherit;
background: lightblue;
font-size: 0.9rem;
padding: 0.25rem;
font-size: 0.9em;
padding: 0.25em;
border: 1px solid #594764;
border-top: 0;
border-bottom: 0;
border-radius: 10px;
cursor: pointer;
line-height: 2rem;
line-height: 2em;
text-align: center;
}

Expand Down Expand Up @@ -193,6 +193,9 @@
box-shadow: 0 5px 0 black;
border-radius: 10px;
}
.mobile-phone .reduct-toolbar {
font-size: 2em;
}

#reduct-toolbar-proto {
display: none;
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function initialize() {
document.body.appendChild(canvas);

if (gfx.viewport.IS_PHONE) {
document.body.classList.add("mobile-phone");
canvas.style.width = "100%";
}

Expand Down
12 changes: 10 additions & 2 deletions src/ui/reductToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ export default class ReductToolbar {
const absPos = gfx.absolutePos(view);
const absSize = gfx.absoluteSize(view);

toolbar.style.top = `${absPos.y + absSize.h + offsetY}px`;
const posLeft = (absPos.x - (toolbar.clientWidth / 2)) +
let posTop = absPos.y + absSize.h + offsetY;
let posLeft = (absPos.x - (toolbar.clientWidth / 2)) +
(absSize.w / 2) +
offsetX;

// TODO: refactor this to stage?
if (gfx.viewport.IS_PHONE) {
posTop *= 1.33;
posLeft *= 1.33;
}

toolbar.style.top = `${posTop}px`;
toolbar.style.left = `${posLeft}px`;
}

Expand Down

0 comments on commit 8cc435e

Please sign in to comment.