0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-12 17:24:57 +01:00
doodle3d-client/www/printmanager/js/Viewer.js

27 lines
615 B
JavaScript
Raw Normal View History

2015-04-28 12:47:44 +02:00
var Viewer = function(_viewer) {
var className = "Viewer";
2015-04-28 12:47:44 +02:00
var viewer = _viewer;
2015-04-27 23:38:01 +02:00
var items = [];
2015-04-28 12:47:44 +02:00
var colors = ['#FF00BF','#FFBF00','#00FFFF','#0040FF','#00FF40','#7F00FF','#FF0000','#80FF00','#FF00BF','#FF0000'];
2015-04-28 12:47:44 +02:00
function setDoodles(doodles) {
for (var i=0; i<doodles.length; i++) {
2015-04-27 23:38:01 +02:00
var item = new ViewerItem(doodles[i]);
items.push(item);
var svg = item.getSvg();
viewer.append(svg);
2015-04-28 12:47:44 +02:00
item.setColor(colors[i % doodles.length]);
}
}
2015-04-28 12:47:44 +02:00
function clear() {
viewer.empty();
items.length = 0;
}
return {
setDoodles: setDoodles,
2015-04-28 12:47:44 +02:00
clear: clear,
}
}