Skip to content

Commit

Permalink
more layout bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Aug 16, 2012
1 parent 73ecaef commit 9c60e52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/JBrowse/View/Layout2.js
Expand Up @@ -94,7 +94,7 @@ return declare( null,
// just a suggestion
discardRange: function( left, right ) {
left = Math.ceil( left / this.pitchX );
right = Math.floor( right / this.pitchY );
right = Math.floor( right / this.pitchX );
var b = this.bitmap;
for( var x = left; x<=right; x++ ) {
var slice = b[x];
Expand Down
32 changes: 9 additions & 23 deletions src/JBrowse/View/Track/HTMLFeatures.js
Expand Up @@ -444,16 +444,15 @@ var HTMLFeatures = declare( BlockBased,
transfer: function(sourceBlock, destBlock, scale, containerStart, containerEnd) {

if (!(sourceBlock && destBlock)) return;
if (!sourceBlock.featureLayout) return;

var destLeft = destBlock.startBase;
var destRight = destBlock.endBase;
var blockWidth = destRight - destLeft;
var sourceSlot;

var overlaps = (sourceBlock.startBase < destBlock.startBase)
? sourceBlock.featureLayout.rightOverlaps
: sourceBlock.featureLayout.leftOverlaps;
? sourceBlock.rightOverlaps
: sourceBlock.leftOverlaps;
overlaps = overlaps || [];

for (var i = 0; i < overlaps.length; i++) {
Expand Down Expand Up @@ -493,24 +492,11 @@ var HTMLFeatures = declare( BlockBased,
fillFeatures: function(blockIndex, block, leftBlock, rightBlock, leftBase, rightBase, scale, containerStart, containerEnd) {

this.scale = scale;
this.layout = this.layout && this.layout.pitchX == 3/scale ? this.layout : new Layout({pitchX: 3/scale });
var layouter = this.layout;
block.featureLayout = layouter;
if( ! this.layout || this.layout.pitchX != 3/scale )
this.layout = new Layout({pitchX: 3/scale });
block.featureNodes = {};
block.style.backgroundColor = "#ddd";

//are we filling right-to-left (true) or left-to-right (false)?
var goLeft = false;
// if (leftBlock && leftBlock.featureLayout) {
// leftBlock.featureLayout.setRightLayout(layouter);
// layouter.setLeftLayout(leftBlock.featureLayout);
// }
// if (rightBlock && rightBlock.featureLayout) {
// rightBlock.featureLayout.setLeftLayout(layouter);
// layouter.setRightLayout(rightBlock.featureLayout);
// //goLeft = true;
// }

//determine the glyph height, arrowhead width, label text dimensions, etc.
if (!this.haveMeasurements) {
this.measureStyles();
Expand All @@ -524,7 +510,7 @@ var HTMLFeatures = declare( BlockBased,
//(the top-level NCList covers a track/chromosome combination)
var uniqueId = path.join(",");
//console.log("ID " + uniqueId + (layouter.hasSeen(uniqueId) ? " (seen)" : " (new)"));
if (layouter.hasSeen(uniqueId)) {
if (curTrack.layout.hasSeen(uniqueId)) {
//console.log("this layouter has seen " + uniqueId);
return;
}
Expand All @@ -533,13 +519,13 @@ var HTMLFeatures = declare( BlockBased,
containerStart, containerEnd, block );
};

var startBase = goLeft ? rightBase : leftBase;
var endBase = goLeft ? leftBase : rightBase;
// var startBase = goLeft ? rightBase : leftBase;
// var endBase = goLeft ? leftBase : rightBase;

this.featureStore.iterate(startBase, endBase, featCallback,
this.featureStore.iterate( leftBase, rightBase, featCallback,
function () {
block.style.backgroundColor = "";
curTrack.heightUpdate(layouter.getTotalHeight(),
curTrack.heightUpdate(curTrack.layout.getTotalHeight(),
blockIndex);
});
},
Expand Down

0 comments on commit 9c60e52

Please sign in to comment.