Skip to content

Edited the visual demo code for the panels #188

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: master
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
55 changes: 55 additions & 0 deletions visual/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,61 @@ h1, h2, h3, h4, h5, h6 {
text-decoration: underline;
}

#show_instructions_panel {
top: 20px;
left: 20px;
width: 550px;
background-color:rgba(125, 125, 125, 0.6);
box-shadow: 0px 0px 0px rgba(255, 255, 255, 0);
}

#show_instructions {
position: absolute;
right: 25px;
top: 10px;
font-size: 90%;
cursor: pointer;
}

#show_instructions:hover {
color: #ffffff;
text-decoration: underline;
}

#hide_algorithms {
position: absolute;
right: 10px;
top: 5px;
font-size: 90%;
cursor: pointer;
}

#hide_algorithms:hover {
color: #fff;
text-decoration: underline;
}

#show_algorithms_panel {
right: 20px;
top: 20px;
width: 250px;
background-color:rgba(125, 125, 125, 0.6);
box-shadow: 0px 0px 0px rgba(255, 255, 255, 0);
}

#show_algorithms {
position: absolute;
right: 10px;
top: 5px;
font-size: 90%;
cursor: pointer;
}

#show_algorithms:hover {
color: #fff;
text-decoration: underline;
}

.option_header {
font-size: 80%;
margin-left: 20px;
Expand Down
14 changes: 12 additions & 2 deletions visual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@
<body>
<div id="draw_area"></div>

<div id="show_instructions_panel" class="panel">
<span id="show_instructions"style="display:none">show</span>
</div>

<div id="instructions_panel" class="panel">
<header>
<h2 class="header_title">Instructions</h2>
<span id="hide_instructions">hide</span>
<span id="hide_instructions"onclick="hide_instructions_clicked()">hide</span>
</header>
Click within the <span class="white">white</span> grid and drag your mouse to draw obstacles. <br>
Drag the <span class="green">green</span> node to set the start position. <br>
Expand All @@ -42,8 +46,14 @@ <h2 class="header_title">Instructions</h2>
Click Start Search in the lower-right corner to start the animation.
</div>

<div id="show_algorithms_panel" class="panel">
<span id="show_algorithms"style="display:none">show</span>
</div>

<div id="algorithm_panel" class="panel right_panel">
<header><h2 class="header_title">Select Algorithm</h2></header>
<header><h2 class="header_title">Select Algorithm</h2>
<span id="hide_algorithms"onclick="hide_algorithms_clicked()">hide</span>
</header>

<div class="accordion">
<h3 id="astar_header"><a href="#">A*</a></h3>
Expand Down
24 changes: 21 additions & 3 deletions visual/js/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,41 @@ var Panel = {
$('#hide_instructions').click(function() {
$('#instructions_panel').slideUp();
});
$('#hide_algorithms').click(function() {
$('#algorithm_panel').slideUp();
});
$('#play_panel').css({
top: $algo.offset().top + $algo.outerHeight() + 20
});
$('#button2').attr('disabled', 'disabled');

$('#hide_instructions').click(function(hide_instructions_clicked) {
$('#show_instructions').show();
});
$('#hide_algorithms').click(function(hide_algorithms_clicked) {
$('#show_algorithms').show();
});
$('#show_algorithms').click(function() {
$('#algorithm_panel').slideDown();
$('#show_algorithms').hide();
});
$('#show_instructions').click(function() {
$('#instructions_panel').slideDown();
$('#show_instructions').hide();
});
},
/**
* Get the user selected path-finder.
* TODO: clean up this messy code.
*/
getFinder: function() {
var finder, selected_header, heuristic, allowDiagonal, biDirectional, dontCrossCorners, weight, trackRecursion, timeLimit;

selected_header = $(
'#algorithm_panel ' +
'.ui-accordion-header[aria-selected=true]'
).attr('id');

switch (selected_header) {

case 'astar_header':
Expand Down Expand Up @@ -131,7 +149,7 @@ var Panel = {
trackRecursion = typeof $('#jump_point_section ' +
'.track_recursion:checked').val() !== 'undefined';
heuristic = $('input[name=jump_point_heuristic]:checked').val();

finder = new PF.JumpPointFinder({
trackJumpRecursion: trackRecursion,
heuristic: PF.Heuristic[heuristic],
Expand Down