Updated buttons, started to fix up UI
This commit is contained in:
parent
7aca5737a4
commit
e73ba39e13
28
index.html
28
index.html
|
@ -13,18 +13,20 @@
|
|||
left: 0px;
|
||||
right: 0px;
|
||||
z-index: 100;
|
||||
width: 320px;
|
||||
width: 400px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#dialog {
|
||||
transition: height 1.5s;
|
||||
height: 0px;
|
||||
transition: height 0.3s;
|
||||
background: #DDD;
|
||||
border-radius: 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#dialog.expanded {
|
||||
height: 400px;
|
||||
#dialog.hidden {
|
||||
height: 0px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
button {
|
||||
|
@ -32,6 +34,10 @@ button {
|
|||
height: 30px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
background: #DEF;
|
||||
outline: 0 !important;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
button.active {
|
||||
|
@ -39,11 +45,17 @@ button.active {
|
|||
}
|
||||
|
||||
#ascii-canvas {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
cursor: crosshair;
|
||||
};
|
||||
|
||||
#export-area {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -56,7 +68,9 @@ button.active {
|
|||
<button id="move-button">Resize</button>
|
||||
<button id="menu-button">Menu</button>
|
||||
</div>
|
||||
<div id="dialog"></div>
|
||||
<div id="dialog" class="hidden">
|
||||
<textarea id="export-area"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<canvas id="ascii-canvas"></canvas>
|
||||
<script src="jquery-1.9.1.min.js"></script>
|
||||
|
|
|
@ -146,23 +146,36 @@ ascii.Controller.prototype.installBindings = function() {
|
|||
});
|
||||
// TODO: Handle pinch to zoom.
|
||||
|
||||
$('#box-button').click(function(e) {
|
||||
this.drawFunction = new ascii.DrawBox(this.state);
|
||||
}.bind(this));
|
||||
|
||||
$('#line-button').click(function(e) {
|
||||
this.drawFunction = new ascii.DrawLine(this.state);
|
||||
}.bind(this));
|
||||
|
||||
$('#freeform-button').click(function(e) {
|
||||
this.drawFunction = new ascii.DrawFreeform(this.state, '+');
|
||||
}.bind(this));
|
||||
|
||||
$('#erase-button').click(function(e) {
|
||||
this.drawFunction = new ascii.DrawFreeform(this.state, null);
|
||||
}.bind(this));
|
||||
|
||||
$('#move-button').click(function(e) {
|
||||
this.drawFunction = new ascii.DrawMove(this.state);
|
||||
$('#buttons > button').click(function(e) {
|
||||
this.updateButtons(e.target.id);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles the buttons in the UI.
|
||||
* @param {string} id The ID of the element clicked.
|
||||
*/
|
||||
ascii.Controller.prototype.updateButtons = function(id) {
|
||||
$('#buttons > button').removeClass();
|
||||
$('#dialog').addClass('hidden');
|
||||
$('#' + id).addClass('active');
|
||||
if (id == 'menu-button') {
|
||||
$('#dialog').removeClass('hidden');
|
||||
}
|
||||
// Install the right draw tool based on button pressed.
|
||||
if (id == 'box-button') {
|
||||
this.drawFunction = new ascii.DrawBox(this.state);
|
||||
}
|
||||
if (id == 'line-button') {
|
||||
this.drawFunction = new ascii.DrawLine(this.state);
|
||||
}
|
||||
if (id == 'freeform-button') {
|
||||
this.drawFunction = new ascii.DrawFreeform(this.state, '+');
|
||||
}
|
||||
if (id == 'erase-button') {
|
||||
this.drawFunction = new ascii.DrawFreeform(this.state, null);
|
||||
}
|
||||
if (id == 'move-button') {
|
||||
this.drawFunction = new ascii.DrawMove(this.state);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue