Skip to content

Commit 1af7bcf

Browse files
committed
Added dimensions to info box
1 parent 28e6e3f commit 1af7bcf

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

mandelbrot.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
}
8383

8484
#infoBox {
85+
text-align:right;
8586
z-index: 10;
8687
position: absolute;
8788
right: 5px;
@@ -93,6 +94,7 @@
9394
text-shadow: none;
9495

9596
font-family: sans-serif;
97+
font-size:8pt;
9698
}
9799

98100
#description table {
@@ -231,7 +233,7 @@ <h1>The Mandelbrot Set</h1>
231233
</div>
232234

233235
<div id="infoBox">
234-
<small><span id="infoText"></span></small>
236+
<span id="infoText"></span>
235237
</div>
236238

237239
<script type="text/javascript" src="mandelbrot.js">

mandelbrot.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ function updateHashTag(samples, iterations)
4949
'colorScheme=' + scheme;
5050
}
5151

52+
/*
53+
* Update small info box in lower right hand side
54+
*/
55+
function updateInfoBox()
56+
{
57+
// Update infobox
58+
$('infoBox').innerHTML =
59+
'x<sub>0</sub>=' + xRange[0] + ' y<sub>0</sub>=' + yRange[0] + ' ' +
60+
'x<sub>1</sub>=' + xRange[1] + ' y<sub>1</sub>=' + yRange[1] + ' ' +
61+
'w&#10799;h=' + canvas.width + 'x' + canvas.height + ' '
62+
+ (canvas.width*canvas.height/1000000.0).toFixed(1) + 'MP';
63+
}
64+
5265
/*
5366
* Parse URL hash tag, returns whether we should redraw.
5467
*/
@@ -214,11 +227,7 @@ function draw(pickColor, superSamples)
214227
var Ci_step = (yRange[1] - yRange[0]) / (0.5 + (canvas.height-1));
215228

216229
updateHashTag(superSamples, steps);
217-
218-
// Update infobox
219-
$('infoBox').innerHTML =
220-
'x<sub>0</sub>=' + xRange[0] + ' y<sub>0</sub>=' + yRange[0] + ' ' +
221-
'x<sub>1</sub>=' + xRange[1] + ' y<sub>1</sub>=' + yRange[1];
230+
updateInfoBox();
222231

223232
// Only enable one render at a time
224233
renderId += 1;

0 commit comments

Comments
 (0)