commit/galaxy-central: jgoecks: Trackster bug fixes: (a) prevent dragging tracks above reference track and (b) fix tile's low location when showing tile.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/c2cb11dd86d8/ changeset: c2cb11dd86d8 user: jgoecks date: 2012-02-27 19:47:41 summary: Trackster bug fixes: (a) prevent dragging tracks above reference track and (b) fix tile's low location when showing tile. affected #: 1 file diff -r 167fddae9646f761a87c99a15984f52a605cc498 -r c2cb11dd86d8b6fd8799a3b0fa6d685eae0c5e98 static/scripts/trackster.js --- a/static/scripts/trackster.js +++ b/static/scripts/trackster.js @@ -328,11 +328,16 @@ // Handle sibling movement, aka sorting. // Determine new position + var child; for ( i = 0; i < children.length; i++ ) { - if ( d.offsetY < $(children.get(i)).position().top ) { + child = $(children.get(i)); + if ( d.offsetY < child.position().top && + // Cannot move tracks above reference track or intro div. + !(child.hasClass("reference-track") || child.hasClass("intro")) ) { break; } } + // If not already in the right place, move. Need // to handle the end specially since we don't have // insert at index @@ -2893,9 +2898,9 @@ var Tile = function(track, index, resolution, canvas, data) { this.track = track; this.index = index; - // FIXME: find better way to calculate low, high. - this.low = index * TILE_SIZE * resolution - this.high = (index + 1) * TILE_SIZE * resolution; + var tile_bounds = this.track._get_tile_bounds(index, resolution); + this.low = tile_bounds[0]; + this.high = tile_bounds[1]; this.resolution = resolution; // Wrap element in div for background. this.html_elt = $("<div class='track-tile'/>").append(canvas); @@ -4153,7 +4158,7 @@ * Draw ReferenceTrack tile. */ draw_tile: function(seq, ctx, mode, resolution, tile_index, w_scale) { - var track = this; + var track = this; if (w_scale > this.view.canvas_manager.char_width_px) { if (seq.data === null) { @@ -4165,7 +4170,7 @@ ctx.textAlign = "center"; seq = seq.data; for (var c = 0, str_len = seq.length; c < str_len; c++) { - var c_start = Math.round(c * w_scale); + var c_start = Math.floor(c * w_scale); ctx.fillText(seq[c], c_start, 10); } return new Tile(track, tile_index, resolution, canvas, seq); @@ -4331,7 +4336,7 @@ painter = new painters.LinePainter(result.data, tile_low, tile_high, this.prefs, mode); painter.draw(ctx, canvas.width, canvas.height, w_scale); - return new Tile(this.track, tile_index, resolution, canvas, result.data); + return new Tile(this, tile_index, resolution, canvas, result.data); }, /** * LineTrack data cannot currently be subsetted. 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