Commit 973208c3 authored by Joshua Gould's avatar Joshua Gould

scroll lens

parent baa26b67
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3541,7 +3541,6 @@ Copyright (c) 2015 Daniel Eden ...@@ -3541,7 +3541,6 @@ Copyright (c) 2015 Daniel Eden
.morpheus-tip-inline { .morpheus-tip-inline {
font-size: 12px; font-size: 12px;
max-width: 400px;
z-index: 10000; z-index: 10000;
position: absolute; position: absolute;
background-color: rgba(255, 255, 255, 0.9); background-color: rgba(255, 255, 255, 0.9);
......
...@@ -72,7 +72,6 @@ ...@@ -72,7 +72,6 @@
.morpheus-tip-inline { .morpheus-tip-inline {
font-size: 12px; font-size: 12px;
max-width: 400px;
z-index: 10000; z-index: 10000;
position: absolute; position: absolute;
background-color: rgba(255, 255, 255, 0.9); background-color: rgba(255, 255, 255, 0.9);
......
morpheus.DatasetUtil = function() { morpheus.DatasetUtil = function() {
}; };
morpheus.DatasetUtil.min = function(dataset) { morpheus.DatasetUtil.min = function(dataset, seriesIndex) {
seriesIndex = seriesIndex || 0;
var min = Number.MAX_VALUE; var min = Number.MAX_VALUE;
for (var i = 0, rows = dataset.getRowCount(); i < rows; i++) { for (var i = 0, rows = dataset.getRowCount(); i < rows; i++) {
for (var j = 0, columns = dataset.getColumnCount(); j < columns; j++) { for (var j = 0, columns = dataset.getColumnCount(); j < columns; j++) {
var d = dataset.getValue(i, j); var d = dataset.getValue(i, j, seriesIndex);
if (isNaN(d)) { if (isNaN(d)) {
continue; continue;
} }
...@@ -20,11 +21,12 @@ morpheus.DatasetUtil.transposedView = function(dataset) { ...@@ -20,11 +21,12 @@ morpheus.DatasetUtil.transposedView = function(dataset) {
return dataset instanceof morpheus.TransposedDatasetView ? dataset return dataset instanceof morpheus.TransposedDatasetView ? dataset
.getDataset() : new morpheus.TransposedDatasetView(dataset); .getDataset() : new morpheus.TransposedDatasetView(dataset);
}; };
morpheus.DatasetUtil.max = function(dataset) { morpheus.DatasetUtil.max = function(dataset, seriesIndex) {
seriesIndex = seriesIndex || 0;
var max = -Number.MAX_VALUE; var max = -Number.MAX_VALUE;
for (var i = 0, rows = dataset.getRowCount(); i < rows; i++) { for (var i = 0, rows = dataset.getRowCount(); i < rows; i++) {
for (var j = 0, columns = dataset.getColumnCount(); j < columns; j++) { for (var j = 0, columns = dataset.getColumnCount(); j < columns; j++) {
var d = dataset.getValue(i, j); var d = dataset.getValue(i, j, seriesIndex);
if (isNaN(d)) { if (isNaN(d)) {
continue; continue;
} }
......
This diff is collapsed.
morpheus.HeatMapElementCanvas = function(project) { morpheus.HeatMapElementCanvas = function (project) {
morpheus.AbstractCanvas.call(this, true); morpheus.AbstractCanvas.call(this, true);
this.colorScheme = null; this.colorScheme = null;
this.project = project; this.project = project;
...@@ -7,42 +7,42 @@ morpheus.HeatMapElementCanvas = function(project) { ...@@ -7,42 +7,42 @@ morpheus.HeatMapElementCanvas = function(project) {
this.columnPositions = new morpheus.Positions(); this.columnPositions = new morpheus.Positions();
this.rowPositions = new morpheus.Positions(); this.rowPositions = new morpheus.Positions();
this.lastPosition = { this.lastPosition = {
left : -1, left: -1,
right : -1, right: -1,
top : -1, top: -1,
bottom : -1 bottom: -1
}; };
project.getElementSelectionModel().on('selectionChanged', function() { project.getElementSelectionModel().on('selectionChanged', function () {
_this.repaint(); _this.repaint();
}); });
}; };
morpheus.HeatMapElementCanvas.GRID_COLOR = 'rgb(128,128,128)'; morpheus.HeatMapElementCanvas.GRID_COLOR = 'rgb(128,128,128)';
morpheus.HeatMapElementCanvas.prototype = { morpheus.HeatMapElementCanvas.prototype = {
drawGrid : true, drawGrid: true,
getColorScheme : function() { getColorScheme: function () {
return this.colorScheme; return this.colorScheme;
}, },
isDrawGrid : function() { isDrawGrid: function () {
return this.drawGrid; return this.drawGrid;
}, },
setDrawGrid : function(drawGrid) { setDrawGrid: function (drawGrid) {
this.drawGrid = drawGrid; this.drawGrid = drawGrid;
}, },
setColorScheme : function(colorScheme) { setColorScheme: function (colorScheme) {
this.colorScheme = colorScheme; this.colorScheme = colorScheme;
}, },
setDataset : function(dataset) { setDataset: function (dataset) {
this.dataset = dataset; this.dataset = dataset;
this.columnPositions.setLength(this.dataset.getColumnCount()); this.columnPositions.setLength(this.dataset.getColumnCount());
this.rowPositions.setLength(this.dataset.getRowCount()); this.rowPositions.setLength(this.dataset.getRowCount());
}, },
getColumnPositions : function() { getColumnPositions: function () {
return this.columnPositions; return this.columnPositions;
}, },
getRowPositions : function() { getRowPositions: function () {
return this.rowPositions; return this.rowPositions;
}, },
getPreferredSize : function(context) { getPreferredSize: function (context) {
var w = Math.ceil(this.columnPositions.getPosition(this.columnPositions var w = Math.ceil(this.columnPositions.getPosition(this.columnPositions
.getLength() - 1) .getLength() - 1)
+ this.columnPositions.getItemSize(this.columnPositions + this.columnPositions.getItemSize(this.columnPositions
...@@ -52,11 +52,11 @@ morpheus.HeatMapElementCanvas.prototype = { ...@@ -52,11 +52,11 @@ morpheus.HeatMapElementCanvas.prototype = {
+ this.rowPositions + this.rowPositions
.getItemSize(this.rowPositions.getLength() - 1)); .getItemSize(this.rowPositions.getLength() - 1));
return { return {
width : w, width: w,
height : h height: h
}; };
}, },
prePaint : function(clip, context) { prePaint: function (clip, context) {
var lastPosition = this.lastPosition; var lastPosition = this.lastPosition;
var columnPositions = this.columnPositions; var columnPositions = this.columnPositions;
var rowPositions = this.rowPositions; var rowPositions = this.rowPositions;
...@@ -74,7 +74,7 @@ morpheus.HeatMapElementCanvas.prototype = { ...@@ -74,7 +74,7 @@ morpheus.HeatMapElementCanvas.prototype = {
this.invalid = true; this.invalid = true;
} }
}, },
postPaint : function(clip, context) { postPaint: function (clip, context) {
// draw mouse over stuff // draw mouse over stuff
morpheus.CanvasUtil.resetTransform(context); morpheus.CanvasUtil.resetTransform(context);
var project = this.project; var project = this.project;
...@@ -124,7 +124,7 @@ morpheus.HeatMapElementCanvas.prototype = { ...@@ -124,7 +124,7 @@ morpheus.HeatMapElementCanvas.prototype = {
.getViewIndices(); .getViewIndices();
if (selectedElements != null) { if (selectedElements != null) {
selectedElements.forEach(function(id) { selectedElements.forEach(function (id) {
var rowIndex = id.getArray()[0]; var rowIndex = id.getArray()[0];
var columnIndex = id.getArray()[1]; var columnIndex = id.getArray()[1];
if (rowIndex >= top && rowIndex < bottom && columnIndex >= left if (rowIndex >= top && rowIndex < bottom && columnIndex >= left
...@@ -158,23 +158,33 @@ morpheus.HeatMapElementCanvas.prototype = { ...@@ -158,23 +158,33 @@ morpheus.HeatMapElementCanvas.prototype = {
// emptySelection = emptySelection && selectedColumnElements.size() == // emptySelection = emptySelection && selectedColumnElements.size() ==
// 0; // 0;
}, },
setElementDrawCallback : function(elementDrawCallback) { setElementDrawCallback: function (elementDrawCallback) {
this._elementDrawCallback = elementDrawCallback; this._elementDrawCallback = elementDrawCallback;
}, },
setDrawCallback : function(drawCallback) { draw: function (clip, context) {
this.drawCallback = drawCallback;
},
draw : function(clip, context) {
var columnPositions = this.columnPositions; var columnPositions = this.columnPositions;
var rowPositions = this.rowPositions; var rowPositions = this.rowPositions;
var left = morpheus.Positions.getLeft(clip, columnPositions); var left = morpheus.Positions.getLeft(clip, columnPositions);
var right = morpheus.Positions.getRight(clip, columnPositions); var right = morpheus.Positions.getRight(clip, columnPositions);
var top = morpheus.Positions.getTop(clip, rowPositions); var top = morpheus.Positions.getTop(clip, rowPositions);
var bottom = morpheus.Positions.getBottom(clip, rowPositions); var bottom = morpheus.Positions.getBottom(clip, rowPositions);
context.translate(-clip.x, -clip.y);
this._draw({left: left, right: right, top: top, bottom: bottom, context: context});
context.translate(clip.x, clip.y);
},
_draw: function (options) {
var left = options.left;
var right = options.right;
var top = options.top;
var bottom = options.bottom;
var context = options.context;
var dataset = this.dataset; var dataset = this.dataset;
var columnPositions = this.columnPositions;
var rowPositions = this.rowPositions;
// context.fillStyle = 'LightGrey'; // context.fillStyle = 'LightGrey';
// context.fillRect(0, 0, this.canvas.width, this.canvas.height); // context.fillRect(0, 0, this.canvas.width, this.canvas.height);
context.translate(-clip.x, -clip.y);
var colorScheme = this.colorScheme; var colorScheme = this.colorScheme;
var drawGrid = this.drawGrid; var drawGrid = this.drawGrid;
...@@ -279,22 +289,8 @@ morpheus.HeatMapElementCanvas.prototype = { ...@@ -279,22 +289,8 @@ morpheus.HeatMapElementCanvas.prototype = {
} }
} }
if (this.drawCallback) {
this.drawCallback({
context : context,
dataset : dataset,
top : top,
bottom : bottom,
left : left,
right : right,
rowPositions : rowPositions,
columnPositions : columnPositions,
project : this.project,
clip : clip
});
}
context.lineWidth = 1; context.lineWidth = 1;
context.translate(clip.x, clip.y);
} }
}; };
morpheus.Util.extend(morpheus.HeatMapElementCanvas, morpheus.AbstractCanvas); morpheus.Util.extend(morpheus.HeatMapElementCanvas, morpheus.AbstractCanvas);
This diff is collapsed.
/** /**
* @param model{morpheus.SelectionModel} * @param model{morpheus.SelectionModel}
*/ */
morpheus.ScentedSearch = function(model, positions, isVertical, scrollbar, morpheus.ScentedSearch = function (model, positions, isVertical, scrollbar,
controller) { controller) {
morpheus.AbstractCanvas.call(this, false); morpheus.AbstractCanvas.call(this, false);
this.model = model; this.model = model;
...@@ -12,13 +12,14 @@ morpheus.ScentedSearch = function(model, positions, isVertical, scrollbar, ...@@ -12,13 +12,14 @@ morpheus.ScentedSearch = function(model, positions, isVertical, scrollbar,
this.searchIndices = []; this.searchIndices = [];
scrollbar.decorator = this; scrollbar.decorator = this;
var _this = this; var _this = this;
var mouseMove = function(e) { var mouseMove = function (e) {
var index = _this.getIndex(e); var index = _this.getIndex(e);
_this.mouseMovedIndex = index; _this.mouseMovedIndex = index;
document.body.style.cursor = index < 0 ? 'default' : 'pointer'; document.body.style.cursor = index < 0 ? 'default' : 'pointer';
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
}; };
if (isVertical) { if (isVertical) {
controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1, controller.setToolTip(index >= 0 ? _this.searchIndices[index] : -1,
...@@ -29,24 +30,24 @@ morpheus.ScentedSearch = function(model, positions, isVertical, scrollbar, ...@@ -29,24 +30,24 @@ morpheus.ScentedSearch = function(model, positions, isVertical, scrollbar,
} }
}; };
var mouseExit = function(e) { var mouseExit = function (e) {
// need to set body cursor b/c mouse can be partially on the scroll bar, // need to set body cursor b/c mouse can be partially on the scroll bar,
// but the canvas cursor has no effect // but the canvas cursor has no effect
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
scrollbar.canvas.style.cursor = 'default'; scrollbar.canvas.style.cursor = 'default';
}; };
$(scrollbar.canvas).on('mousemove', mouseMove).on('mouseexit', mouseExit); $(scrollbar.canvas).on('mousemove', mouseMove).on('mouseout', mouseExit);
}; };
morpheus.ScentedSearch.LINE_HEIGHT = 3.5; morpheus.ScentedSearch.LINE_HEIGHT = 3.5;
morpheus.ScentedSearch.prototype = { morpheus.ScentedSearch.prototype = {
mouseMovedIndex : -1, mouseMovedIndex: -1,
getIndex : function(event) { getIndex: function (event) {
var pix = morpheus.CanvasUtil.getMousePos(event.target, event); var pix = morpheus.CanvasUtil.getMousePos(event.target, event);
var val = pix[this.isVertical ? 'y' : 'x']; var val = pix[this.isVertical ? 'y' : 'x'];
return this.getIndexForPix(val); return this.getIndexForPix(val);
}, },
getIndexForPix : function(pix) { getIndexForPix: function (pix) {
var indices = this.searchIndices; var indices = this.searchIndices;
if (indices == null) { if (indices == null) {
return -1; return -1;
...@@ -85,7 +86,7 @@ morpheus.ScentedSearch.prototype = { ...@@ -85,7 +86,7 @@ morpheus.ScentedSearch.prototype = {
return -1; // -(low + 1); // key not found. return -1; // -(low + 1); // key not found.
}, },
tap : function(position) { tap: function (position) {
var val = position[this.isVertical ? 'y' : 'x']; var val = position[this.isVertical ? 'y' : 'x'];
var index = this.getIndexForPix(val); var index = this.getIndexForPix(val);
this.scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer'; this.scrollbar.canvas.style.cursor = index < 0 ? 'default' : 'pointer';
...@@ -101,13 +102,13 @@ morpheus.ScentedSearch.prototype = { ...@@ -101,13 +102,13 @@ morpheus.ScentedSearch.prototype = {
} }
return false; return false;
}, },
update : function() { update: function () {
this.searchIndices = this.model.getViewIndices().values().sort( this.searchIndices = this.model.getViewIndices().values().sort(
function(a, b) { function (a, b) {
return a < b ? -1 : 1; return a < b ? -1 : 1;
}); });
}, },
draw : function(clip, context) { draw: function (clip, context) {
var width = this.scrollbar.getUnscaledWidth(); var width = this.scrollbar.getUnscaledWidth();
var height = this.scrollbar.getUnscaledHeight(); var height = this.scrollbar.getUnscaledHeight();
var availableLength = ((this.isVertical ? height : width)) var availableLength = ((this.isVertical ? height : width))
...@@ -121,7 +122,7 @@ morpheus.ScentedSearch.prototype = { ...@@ -121,7 +122,7 @@ morpheus.ScentedSearch.prototype = {
this.drawIndices(context, this.searchIndices); this.drawIndices(context, this.searchIndices);
this.drawHoverMatchingValues(context); this.drawHoverMatchingValues(context);
}, },
drawHoverMatchingValues : function(context) { drawHoverMatchingValues: function (context) {
var heatmap = this.controller; var heatmap = this.controller;
context.fillStyle = 'black'; context.fillStyle = 'black';
if (heatmap.mousePositionOptions if (heatmap.mousePositionOptions
...@@ -186,7 +187,7 @@ morpheus.ScentedSearch.prototype = { ...@@ -186,7 +187,7 @@ morpheus.ScentedSearch.prototype = {
} }
}, },
drawIndices : function(context, highlightedIndices) { drawIndices: function (context, highlightedIndices) {
var scale = this.scale; var scale = this.scale;
var lineLength = !this.isVertical ? this.scrollbar.getUnscaledHeight() var lineLength = !this.isVertical ? this.scrollbar.getUnscaledHeight()
: this.scrollbar.getUnscaledWidth(); : this.scrollbar.getUnscaledWidth();
......
This diff is collapsed.
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