|
|
@ -90,13 +90,14 @@
|
|
90
|
90
|
pixl.draw_pixl = function(pos, color, options) {
|
|
91
|
91
|
var color = color || pixl.color;
|
|
92
|
92
|
pixl.ctx.fillStyle = color;
|
|
|
93
|
var options = options || {};
|
|
93
|
94
|
var pos = options.rawValue ? pos : {x: Math.round(pos.x), y: Math.round(pos.y)};
|
|
94
|
95
|
var screen_pos = pixl.to_screen(pos);
|
|
95
|
96
|
pixl.ctx.fillRect(screen_pos.x, screen_pos.y, pixl.size, pixl.size);
|
|
96
|
97
|
pixl.world[pos.x + "," + pos.y] = {color: color};
|
|
97
|
98
|
|
|
98
|
|
var options = options || {send: true};
|
|
99
|
|
if (pixl.online && options.send) {
|
|
|
99
|
var send = options.hasOwnProperty('send') ? options.send : true;
|
|
|
100
|
if (pixl.online && send) {
|
|
100
|
101
|
pixl.ws.send(JSON.stringify([{x: pos.x, y: pos.y, color: color}]));
|
|
101
|
102
|
}
|
|
102
|
103
|
}
|