Skip to content

Commit

Permalink
added scale factor for each layout #30
Browse files Browse the repository at this point in the history
  • Loading branch information
cpietsch committed May 23, 2023
1 parent 470d1a9 commit cc7ff8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions js/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ function Canvas() {
var timelineData;
var stage, stage1, stage2, stage3, stage4, stage5;
var timelineHover = false;
var tsne = [];
var tsneIndex = {};
var tsneScale = {}

function canvas() {}
function canvas() { }

canvas.rangeBand = function () {
return rangeBand;
Expand Down Expand Up @@ -311,8 +311,9 @@ function Canvas() {
state.init = true;
};

canvas.addTsneData = function (name, d) {
canvas.addTsneData = function (name, d, scale) {
tsneIndex[name] = {};
tsneScale[name] = scale;
var clean = d.map(function (d) {
return {
id: d.id,
Expand Down Expand Up @@ -696,8 +697,9 @@ function Canvas() {

canvas.project = function () {
sleep = false;
var scaleFactor = state.mode == "time" ? 0.9 : tsneScale[state.mode] || 0.5;
data.forEach(function (d) {
d.scaleFactor = state.mode == "time" ? 0.9 : 0.5;
d.scaleFactor = scaleFactor;
d.sprite.scale.x = d.scaleFactor;
d.sprite.scale.y = d.scaleFactor;
if (d.sprite2) {
Expand Down
2 changes: 1 addition & 1 deletion js/viz.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function init() {
canvas.setMode(d.title);
} else {
d3.csv(baseUrl.path + d.url, function (tsne) {
canvas.addTsneData(d.title, tsne);
canvas.addTsneData(d.title, tsne, d.scale);
if (i == 0) canvas.setMode(d.title);
});
}
Expand Down

0 comments on commit cc7ff8a

Please sign in to comment.