Skip to content

Commit

Permalink
Hide grid tooltip now dismisses on click, station other lines section…
Browse files Browse the repository at this point in the history
… wont show if there are no other lines to show, station name box wont gain focus if you mouseup from a different text box
  • Loading branch information
shannonturner committed Mar 11, 2019
1 parent 4f7c63b commit 3b10b7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions metro_map_saver/map_saver/static/js/metromapmaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ function makeStation(x, y) {
linesToAdd += '<button style="background-color: #' + allLines[z].id.slice(10, 16) + '" class="station-add-lines" id="add-line-' + allLines[z].id.slice(10, 16) + '">' + $('#' + allLines[z].id).text() + '</button>';
}
} // for allLines
if (linesToAdd) {
if (linesToAdd.length > 0) {
$('#station-other-lines').html(linesToAdd);
$('#add-other-lines').show()
// Bind the event to the .station-add-lines buttons here since they are newly created.
$('.station-add-lines').click(function() {
if ($(this).parent().attr('id') == 'station-other-lines') {
Expand All @@ -311,6 +312,9 @@ function makeStation(x, y) {
autoSave(activeMap)
}); // .station-add-lines.click()
} // if linesToAdd
else {
$('#add-other-lines').hide()
} // not linesToAdd
} // if stationOnLines

// Now, there are two indicators for when a station has been placed on a line
Expand Down Expand Up @@ -370,7 +374,8 @@ function bindGridSquareMouseover(event) {

function bindGridSquareMouseup() {
// Workaround to give focus to #station-name after mousedown
if (activeTool == 'station') {
// Just don't steal focus away from another text box
if (activeTool == 'station' && document.activeElement.type != 'text') {
$('#station-name').focus()
}
}
Expand Down Expand Up @@ -1189,6 +1194,7 @@ $(document).ready(function() {
$('canvas#grid-canvas').css("opacity", 0);
$('#tool-grid').html('<i class="fa fa-table" aria-hidden="true"></i> Show grid');
}
$('.tooltip').hide()
}); // #tool-grid.click() (Toggle grid visibility)
$('#tool-zoom-in').click(function() {
resizeCanvas('in')
Expand Down
2 changes: 1 addition & 1 deletion metro_map_saver/map_saver/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ <h5>In relation to the station marker, where should the name begin?</h5>
</select>
<h4>This station is on these rail lines:</h4>
<div id="station-on-lines"></div>
<h4>Add other lines this station serves:</h4>
<h4 id="add-other-lines">Add other lines this station serves:</h4>
<div id="station-other-lines"></div>
</div>
<button id="tool-eraser" class="btn btn-info has-tooltip" data-toggle="tooltip" data-placement="left" title="Erase a painted rail line or station"><i class="fa fa-eraser" aria-hidden="true"></i> Eraser</button>
Expand Down

0 comments on commit 3b10b7a

Please sign in to comment.