Skip to content

Commit

Permalink
Valis 43 rect highlight location (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
leepc12 authored Feb 4, 2022
1 parent 2d77999 commit 1218e55
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 25 deletions.
21 changes: 13 additions & 8 deletions dist/valis-hpgv.js
Original file line number Diff line number Diff line change
Expand Up @@ -75703,14 +75703,19 @@ var TrackObject = /** @class */ (function (_super) {
if (withinBounds && this.highlightLocation) {
var highlightChr = this.highlightLocation.split(':')[0];
var contigPosition = contig ? contig : this.contig;
var highlightPosition = void 0;
if (highlightChr !== contigPosition) {
highlightPosition = NaN;
}
else {
highlightPosition = +this.highlightLocation.split(':')[1];
if (highlightChr === contigPosition) {
var highlightStart = +this.highlightLocation.split(':')[1].split('-')[0];
var highlightEnd = +this.highlightLocation.split(':')[1].split('-')[1];
var highlightRelativeX = (highlightStart - this.x0 - 1.0) / (this.x1 - this.x0);
var highlightRelativeW = (highlightEnd - highlightStart + 0.95) / (this.x1 - this.x0);
var leftBoundaryRelativeX = -0.05;
if (highlightRelativeX < leftBoundaryRelativeX) {
highlightRelativeW -= (leftBoundaryRelativeX - highlightRelativeX);
highlightRelativeX = leftBoundaryRelativeX;
}
highlightPointer.relativeX = highlightRelativeX;
highlightPointer.relativeW = Math.max(0.0, highlightRelativeW);
}
highlightPointer.relativeX = (highlightPosition - this.x0 - 0.5) / (this.x1 - this.x0);
}
};
TrackObject.prototype.removeAxisPointer = function (id) {
Expand Down Expand Up @@ -75877,11 +75882,11 @@ var HighlightPointer = /** @class */ (function (_super) {
var _this = _super.call(this, 0, 0) || this;
_this.activeColor = activeColor;
_this.secondaryColor = secondaryColor;
_this.originX = -0.5;
_this.relativeH = 1;
// this is the width, in pixels, of the highlight region
_this.w = 3;
_this.transparent = true;
_this.opacity = 0.6;
_this.setStyle(style);
return _this;
}
Expand Down
6 changes: 5 additions & 1 deletion dist/valis-hpgv.js.map

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions dist/valis-hpgv.react-peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47428,14 +47428,19 @@ var TrackObject = /** @class */ (function (_super) {
if (withinBounds && this.highlightLocation) {
var highlightChr = this.highlightLocation.split(':')[0];
var contigPosition = contig ? contig : this.contig;
var highlightPosition = void 0;
if (highlightChr !== contigPosition) {
highlightPosition = NaN;
}
else {
highlightPosition = +this.highlightLocation.split(':')[1];
if (highlightChr === contigPosition) {
var highlightStart = +this.highlightLocation.split(':')[1].split('-')[0];
var highlightEnd = +this.highlightLocation.split(':')[1].split('-')[1];
var highlightRelativeX = (highlightStart - this.x0 - 1.0) / (this.x1 - this.x0);
var highlightRelativeW = (highlightEnd - highlightStart + 0.95) / (this.x1 - this.x0);
var leftBoundaryRelativeX = -0.05;
if (highlightRelativeX < leftBoundaryRelativeX) {
highlightRelativeW -= (leftBoundaryRelativeX - highlightRelativeX);
highlightRelativeX = leftBoundaryRelativeX;
}
highlightPointer.relativeX = highlightRelativeX;
highlightPointer.relativeW = Math.max(0.0, highlightRelativeW);
}
highlightPointer.relativeX = (highlightPosition - this.x0 - 0.5) / (this.x1 - this.x0);
}
};
TrackObject.prototype.removeAxisPointer = function (id) {
Expand Down Expand Up @@ -47602,11 +47607,11 @@ var HighlightPointer = /** @class */ (function (_super) {
var _this = _super.call(this, 0, 0) || this;
_this.activeColor = activeColor;
_this.secondaryColor = secondaryColor;
_this.originX = -0.5;
_this.relativeH = 1;
// this is the width, in pixels, of the highlight region
_this.w = 3;
_this.transparent = true;
_this.opacity = 0.6;
_this.setStyle(style);
return _this;
}
Expand Down
6 changes: 5 additions & 1 deletion dist/valis-hpgv.react-peer.js.map

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions src/track/TrackObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,19 @@ export class TrackObject<
if (withinBounds && this.highlightLocation) {
const highlightChr = this.highlightLocation.split(':')[0];
const contigPosition = contig ? contig : this.contig;
let highlightPosition;
if (highlightChr !== contigPosition) {
highlightPosition = NaN;
} else {
highlightPosition = +this.highlightLocation.split(':')[1];
if (highlightChr === contigPosition) {
const highlightStart = +this.highlightLocation.split(':')[1].split('-')[0];
const highlightEnd = +this.highlightLocation.split(':')[1].split('-')[1];
let highlightRelativeX = (highlightStart - this.x0 - 1.0) / (this.x1 - this.x0);
let highlightRelativeW = (highlightEnd - highlightStart + 0.95) / (this.x1 - this.x0);
const leftBoundaryRelativeX = -0.05;
if (highlightRelativeX < leftBoundaryRelativeX) {
highlightRelativeW -= (leftBoundaryRelativeX - highlightRelativeX);
highlightRelativeX = leftBoundaryRelativeX;
}
highlightPointer.relativeX = highlightRelativeX;
highlightPointer.relativeW = Math.max(0.0, highlightRelativeW);
}
highlightPointer.relativeX = (highlightPosition - this.x0 - 0.5) / (this.x1 - this.x0);
}
}

Expand Down Expand Up @@ -378,12 +384,12 @@ export class HighlightPointer extends Rect {
constructor(style: HighlightStyle, public activeColor: ArrayLike<number>, public secondaryColor: ArrayLike<number>, axis: 'x' | 'y') {
super(0, 0);

this.originX = -0.5;
this.relativeH = 1;
// this is the width, in pixels, of the highlight region
this.w = 3;

this.transparent = true;
this.opacity = 0.6;

this.setStyle(style);
}
Expand Down

0 comments on commit 1218e55

Please sign in to comment.