MCPcopy
hub / github.com/jwagner/smartcrop.js / draw

Function draw

examples/testbed.js:234–271  ·  view source on GitHub ↗
(result)

Source from the content-addressed store, hash-verified

232 }
233
234 function draw(result) {
235 var selectedCrop = result.topCrop;
236 $('.crops')
237 .empty()
238 .append(
239 _.sortBy(result.crops, function(c) {
240 return -c.score.total;
241 }).map(function(crop) {
242 return $('<p>')
243 .text(
244 'Score: ' +
245 ~~(crop.score.total * 10000000) +
246 ', ' +
247 crop.x +
248 'x' +
249 crop.y
250 )
251 .hover(
252 function() {
253 drawCrop(crop);
254 },
255 function() {
256 drawCrop(selectedCrop);
257 }
258 )
259 .click(function() {
260 selectedCrop = crop;
261 drawCrop(selectedCrop);
262 })
263 .data('crop', crop);
264 })
265 );
266
267 drawCrop(selectedCrop);
268 $('#debug')
269 .empty()
270 .append(debugDraw(result, true));
271 }
272
273 function drawCrop(crop) {
274 canvas.width = img.width;

Callers

nothing calls this directly

Calls 3

drawCropFunction · 0.85
debugDrawFunction · 0.85
$Function · 0.70

Tested by

no test coverage detected