Skip to content

Commit b4d89e7

Browse files
committed
improved testbed
1 parent 84474c6 commit b4d89e7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/testbed.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ <h1>smartcrop.js testbed</h1>
1212
<form>
1313
<label>Width<div><input name=width type="range" min=50 max=500 step=1 value=250 /><span class=value>250</span>px</div></label>
1414
<label>Height<div><input name=height type="range" min=50 max=500 step=1 value=250 /><span class=value>250</span>px</div></label>
15+
<label>minScale<div><input name=minScale type="range" min=0.5 max=1.0 step=0.1 value=0.9 /><span class=value>0.9</span></div></label>
1516
</form>
1617
</div>
1718
<h2>Drop images on this page to analyze them.</h2>

examples/testbed.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ function load(src){
3535
}
3636
function analyze(){
3737
if(!img) return;
38-
SmartCrop.crop(img, {width: form.width.value, height: form.height.value, debug: true}, draw);
38+
SmartCrop.crop(img, {
39+
width: form.width.value*1,
40+
height: form.height.value*1,
41+
minScale: form.minScale.value*1,
42+
debug: true
43+
}, draw);
3944
}
4045
function draw(result){
4146
selectedCrop = result.topCrop;
42-
$('.crops').append(_.sortBy(result.crops, function(c){return -c.score.total;}).map(function(crop){
47+
$('.crops').empty().append(_.sortBy(result.crops, function(c){return -c.score.total;}).map(function(crop){
4348
return $('<p>')
4449
.text('Score: ' + ~~(crop.score.total*10000000) + ', ' + crop.x+'x'+crop.y)
4550
.hover(function(){

0 commit comments

Comments
 (0)