1

Usability improvements

This commit is contained in:
Alex Yatskov 2014-11-10 19:14:45 +09:00
parent ef15b331fb
commit 10aaeba534
2 changed files with 21 additions and 11 deletions

View File

@ -33,7 +33,7 @@
_ctx.query.features[name] = value; _ctx.query.features[name] = value;
$.getJSON('/search', _ctx.query, function(results) { $.getJSON('/search', _ctx.query, function(results) {
saveSnapshot(results); saveSnapshot(results);
outputSnapshot(results); outputSnapshot(results, true);
setCustomized(true); setCustomized(true);
}); });
} }
@ -160,14 +160,14 @@
$.getJSON('/search', _ctx.query, function(results) { $.getJSON('/search', _ctx.query, function(results) {
saveSnapshot(results); saveSnapshot(results);
outputSnapshot(results); outputSnapshot(results, false);
setCustomized(false); setCustomized(false);
}); });
} }
function onSelectSnapshot() { function onSelectSnapshot() {
var index = $('#historyIndex').slider('getValue'); var index = $('#historyIndex').slider('getValue');
outputSnapshot(_ctx.log[index]); outputSnapshot(_ctx.log[index], false);
setCustomized(true); setCustomized(true);
} }
@ -195,12 +195,15 @@
} }
} }
function outputSnapshot(results) { function outputSnapshot(results, omitValues) {
var columns = {};
for (var name in results.columns) { for (var name in results.columns) {
_ctx.query.features[name] = results.columns[name].value; var column = results.columns[name];
columns[name] = omitValues ? _.omit(column, 'value') : column;
_ctx.query.features[name] = column.value;
} }
_ctx.grapher.setColumns(results.columns); _ctx.grapher.setColumns(columns);
outputMatches(results.items, results.count); outputMatches(results.items, results.count);
} }

View File

@ -89,7 +89,7 @@
var _panelSize = 20; var _panelSize = 20;
var _tickSize = 5; var _tickSize = 5;
var _width = 125; var _width = 125;
var _easeTime = 200; var _easeTime = 400;
var _animation = null; var _animation = null;
var _canvas = params.canvas; var _canvas = params.canvas;
@ -221,6 +221,8 @@
if (_onValueChanged) { if (_onValueChanged) {
_onValueChanged(_name, _data.value); _onValueChanged(_name, _data.value);
} }
animateIndicator(_valueAnimated, _data.value);
} }
function animateIndicator(valueOld, valueNew) { function animateIndicator(valueOld, valueNew) {
@ -239,9 +241,8 @@
updateIndicator(value); updateIndicator(value);
}, },
_easeTime, _easeTime,
mina.linear, mina.easeinout,
function() { function() {
updateDensity();
_animation = null; _animation = null;
} }
); );
@ -283,10 +284,16 @@
} }
this.update = function(data, scale) { this.update = function(data, scale) {
_data = data;
_scale = scale; _scale = scale;
animateIndicator(_valueAnimated, _data.value); if (_.has(data, 'value')) {
_data.value = data.value;
animateIndicator(_valueAnimated, _data.value);
}
if (_.has(data, 'hints')) {
_data.hints = data.hints;
updateDensity();
}
}; };
createShapes(); createShapes();