Commit be21de48 authored by Joshua Gould's avatar Joshua Gould

scroll lens bug fixes when scrolled

parent 973208c3
...@@ -1716,7 +1716,6 @@ morpheus.HeatMap.prototype = { ...@@ -1716,7 +1716,6 @@ morpheus.HeatMap.prototype = {
this.$tipFollow = $('<div style="left:-1000px; top:-1000px;" class="morpheus-tip-inline"></div>'); this.$tipFollow = $('<div style="left:-1000px; top:-1000px;" class="morpheus-tip-inline"></div>');
this.$tipFollow.appendTo(this.$parent); this.$tipFollow.appendTo(this.$parent);
this.$tipInfoWindow = $('<div class="morpheus-tip-dialog"></div>'); this.$tipInfoWindow = $('<div class="morpheus-tip-dialog"></div>');
this.$tipInfoWindow.appendTo(this.$parent); this.$tipInfoWindow.appendTo(this.$parent);
...@@ -2154,9 +2153,8 @@ morpheus.HeatMap.prototype = { ...@@ -2154,9 +2153,8 @@ morpheus.HeatMap.prototype = {
if (this.options.showSeriesNameInTooltip) { if (this.options.showSeriesNameInTooltip) {
options.showSeriesNameInTooltip = true; options.showSeriesNameInTooltip = true;
} }
if (options.dataLens) { if (options.heatMapLens) {
// don't draw lens if currently visible // don't draw lens if currently visible
// row lens // row lens
if (rowIndex >= 0 && (rowIndex >= this.heatmap.lastPosition.bottom || rowIndex < this.heatmap.lastPosition.top)) { if (rowIndex >= 0 && (rowIndex >= this.heatmap.lastPosition.bottom || rowIndex < this.heatmap.lastPosition.top)) {
var heatMapWidth = this.heatmap.getUnscaledWidth(); var heatMapWidth = this.heatmap.getUnscaledWidth();
...@@ -2173,14 +2171,16 @@ morpheus.HeatMap.prototype = { ...@@ -2173,14 +2171,16 @@ morpheus.HeatMap.prototype = {
trackWidth += track.getUnscaledWidth(); trackWidth += track.getUnscaledWidth();
} }
} }
var canvasWidth = trackWidth + heatMapWidth + 1; var canvasWidth = trackWidth + heatMapWidth + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS;
canvas.width = canvasWidth * morpheus.CanvasUtil.BACKING_SCALE; canvas.width = canvasWidth * morpheus.CanvasUtil.BACKING_SCALE;
canvas.style.width = canvasWidth + 'px'; canvas.style.width = canvasWidth + 'px';
canvas.height = heatMapHeight * morpheus.CanvasUtil.BACKING_SCALE; canvas.height = heatMapHeight * morpheus.CanvasUtil.BACKING_SCALE;
canvas.style.height = heatMapHeight + 'px'; canvas.style.height = heatMapHeight + 'px';
var context = canvas.getContext('2d'); var context = canvas.getContext('2d');
context.save();
context.translate(-this.heatmap.lastClip.x, -startPix); context.translate(-this.heatmap.lastClip.x, -startPix);
context.rect(this.heatmap.lastClip.x, startPix, this.heatmap.lastClip.width, this.heatmap.lastClip.height);
context.clip();
this.heatmap._draw({ this.heatmap._draw({
left: this.heatmap.lastPosition.left, left: this.heatmap.lastPosition.left,
right: this.heatmap.lastPosition.right, right: this.heatmap.lastPosition.right,
...@@ -2188,20 +2188,22 @@ morpheus.HeatMap.prototype = { ...@@ -2188,20 +2188,22 @@ morpheus.HeatMap.prototype = {
bottom: bottom, bottom: bottom,
context: context context: context
}); });
context.translate(heatMapWidth + 1, 0); context.restore();
context.translate(heatMapWidth + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS, -startPix);
trackWidth = 0; trackWidth = 0;
for (var i = 0, ntracks = this.rowTracks.length; i < ntracks; i++) { for (var i = 0, ntracks = this.rowTracks.length; i < ntracks; i++) {
var track = this.rowTracks[i]; var track = this.rowTracks[i];
if (track.isVisible()) { if (track.isVisible()) {
context.save(); context.save();
context.translate(trackWidth, 0); context.translate(trackWidth, 0);
context.rect(0, startPix, track.getUnscaledWidth(), track.lastClip.height);
context.clip();
track._draw({ track._draw({
start: top, start: top,
end: bottom, end: bottom,
vector: track.getVector(), vector: track.getVector(),
context: context, context: context,
availableSpace: track.isColumns ? track.getUnscaledHeight() availableSpace: track.getUnscaledWidth()
: track.getUnscaledWidth()
}); });
context.restore(); context.restore();
trackWidth += track.getUnscaledWidth(); trackWidth += track.getUnscaledWidth();
...@@ -2215,7 +2217,7 @@ morpheus.HeatMap.prototype = { ...@@ -2215,7 +2217,7 @@ morpheus.HeatMap.prototype = {
$(canvas).appendTo($wrapper); $(canvas).appendTo($wrapper);
var rect = this.$parent[0].getBoundingClientRect(); var rect = this.$parent[0].getBoundingClientRect();
this.$tipFollow.html($wrapper).css({ this.$tipFollow.html($wrapper).css({
left: parseFloat(this.heatmap.canvas.style.left) - 12, left: parseFloat(this.heatmap.canvas.style.left) - 1,
top: options.event.clientY - rect.top top: options.event.clientY - rect.top
}); });
return; return;
...@@ -2237,19 +2239,35 @@ morpheus.HeatMap.prototype = { ...@@ -2237,19 +2239,35 @@ morpheus.HeatMap.prototype = {
trackHeight += track.getUnscaledHeight(); trackHeight += track.getUnscaledHeight();
} }
} }
var canvasHeight = trackHeight + heatMapHeight + 1; var canvasHeight = trackHeight + heatMapHeight + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS;
canvas.width = heatMapWidth * morpheus.CanvasUtil.BACKING_SCALE; canvas.width = heatMapWidth * morpheus.CanvasUtil.BACKING_SCALE;
canvas.style.width = heatMapWidth + 'px'; canvas.style.width = heatMapWidth + 'px';
canvas.height = canvasHeight * morpheus.CanvasUtil.BACKING_SCALE; canvas.height = canvasHeight * morpheus.CanvasUtil.BACKING_SCALE;
canvas.style.height = canvasHeight + 'px'; canvas.style.height = canvasHeight + 'px';
var context = canvas.getContext('2d'); var context = canvas.getContext('2d');
context.translate(-startPix, -this.heatmap.lastClip.y);
context.translate(-startPix, 0);
context.save();
context.rect(startPix, trackHeight + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS, this.heatmap.lastClip.width, this.heatmap.lastClip.height + trackHeight + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS);
context.clip();
context.translate(0, trackHeight + morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS - this.heatmap.lastClip.y);
this.heatmap._draw({
top: this.heatmap.lastPosition.top,
bottom: this.heatmap.lastPosition.bottom,
left: left,
right: right,
context: context
});
context.restore();
trackHeight = 0; trackHeight = 0;
for (var i = 0, ntracks = this.columnTracks.length; i < ntracks; i++) { for (var i = 0, ntracks = this.columnTracks.length; i < ntracks; i++) {
var track = this.columnTracks[i]; var track = this.columnTracks[i];
if (track.isVisible()) { if (track.isVisible()) {
context.save(); context.save();
context.translate(0, trackHeight); context.translate(0, trackHeight);
context.rect(startPix, 0, track.lastClip.width, track.getUnscaledHeight());
context.clip();
track._draw({ track._draw({
start: left, start: left,
end: right, end: right,
...@@ -2265,23 +2283,16 @@ morpheus.HeatMap.prototype = { ...@@ -2265,23 +2283,16 @@ morpheus.HeatMap.prototype = {
trackHeight += track.getUnscaledHeight(); trackHeight += track.getUnscaledHeight();
} }
} }
context.translate(0, trackHeight);
this.heatmap._draw({
top: this.heatmap.lastPosition.top,
bottom: this.heatmap.lastPosition.bottom,
left: left,
right: right,
context: context
});
var $wrapper = $('<div></div>'); var $wrapper = $('<div></div>');
$wrapper.css({ $wrapper.css({
width: canvas.style.width, width: canvas.style.width,
height: parseFloat(canvas.style.height) + 12 height: parseFloat(canvas.style.height)
}); });
$(canvas).appendTo($wrapper); $(canvas).appendTo($wrapper);
var rect = this.$parent[0].getBoundingClientRect(); var rect = this.$parent[0].getBoundingClientRect();
this.$tipFollow.html($wrapper).css({ this.$tipFollow.html($wrapper).css({
top: parseFloat(this.heatmap.canvas.style.top) - trackHeight - 12, top: parseFloat(this.heatmap.canvas.style.top) - trackHeight - morpheus.HeatMap.SPACE_BETWEEN_HEAT_MAP_AND_ANNOTATIONS - 1,
left: (options.event.clientX - rect.left) - (parseFloat(canvas.style.width) / 2) left: (options.event.clientX - rect.left) - (parseFloat(canvas.style.width) / 2)
}); });
return; return;
...@@ -2307,7 +2318,7 @@ morpheus.HeatMap.prototype = { ...@@ -2307,7 +2318,7 @@ morpheus.HeatMap.prototype = {
} }
if (tipFollowText !== '') { if (tipFollowText !== '') {
this.tipFollowHidden = false; this.tipFollowHidden = false;
this.$tipFollow.html('<span style="max-width:400px;">' + tipFollowText + '</span>'); this.$tipFollow.css('class', 'morpheus-tip-inline morpheus-padding-ver').html('<span style="max-width:400px;">' + tipFollowText + '</span>');
this._updateTipFollowPosition(options); this._updateTipFollowPosition(options);
} else { } else {
this.tipFollowHidden = true; this.tipFollowHidden = true;
...@@ -3566,4 +3577,4 @@ morpheus.HeatMap.copyFromParent = function (project, options) { ...@@ -3566,4 +3577,4 @@ morpheus.HeatMap.copyFromParent = function (project, options) {
} }
} }
}; };
morpheus.Util.extend(morpheus.HeatMap, morpheus.Events); morpheus.Util.extend(morpheus.HeatMap, morpheus.Events);
\ No newline at end of file
...@@ -19,7 +19,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar, ...@@ -19,7 +19,7 @@ morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar,
scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer'; scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer';
var tipOptions = { var tipOptions = {
event: e, event: e,
dataLens: true heatMapLens: true
}; };
if (isVertical) { if (isVertical) {
controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1, controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment