commit/galaxy-central: jgoecks: Trackster: fix feature track bugs so that intervals are correctly drawn as half-open.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/622acea0a86b/ changeset: r5237:622acea0a86b user: jgoecks date: 2011-03-18 19:42:08 summary: Trackster: fix feature track bugs so that intervals are correctly drawn as half-open. affected #: 1 file (30 bytes) --- a/static/scripts/trackster.js Fri Mar 18 14:12:10 2011 -0400 +++ b/static/scripts/trackster.js Fri Mar 18 14:42:08 2011 -0400 @@ -2348,7 +2348,8 @@ var feature_uid = feature[0], feature_start = feature[1], - feature_end = feature[2], + // -1 b/c intervals are half-open. + feature_end = feature[2] - 1, feature_name = feature[3], f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ), f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ), @@ -2440,8 +2441,9 @@ for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) { var block = feature_blocks[k], block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ), - block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) ); - + // -1 b/c intervals are half-open. + block_end = Math.ceil( Math.min(width, Math.max((block[1] - 1 - tile_low) * w_scale)) ); + // Skip drawing if block not on tile. if (block_start > block_end) { continue; } @@ -2453,8 +2455,7 @@ // If block intersects with thick region, draw block as thick. if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) { var block_thick_start = Math.max(block_start, thick_start), - // -1 b/c intervals are half-open. - block_thick_end = Math.min(block_end, thick_end-1); + block_thick_end = Math.min(block_end, thick_end); ctx.fillRect(block_thick_start + left_offset, y_center + 1, block_thick_end - block_thick_start, thick_height); } Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket