Просмотр исходного кода

fix draw_pixl without any options passed.

Lucas Stadler лет назад: 12
Родитель
Сommit
bf2b2cd224
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      js/pixl/public/index.html

+ 3 - 2
js/pixl/public/index.html

@ -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
		}