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