|
1250 | 1250 | } else if (parsed.type === "line") {
|
1251 | 1251 | drawLine(context, parsed.data.fromX * scaleDownFactor(), parsed.data.fromY * scaleDownFactor(), parsed.data.toX * scaleDownFactor(), parsed.data.toY * scaleDownFactor(), parsed.data.color, parsed.data.lineWidth * scaleDownFactor());
|
1252 | 1252 | } else if (parsed.type === "fill") {
|
1253 |
| - floodfillContext(context, parsed.data.x * scaleDownFactor(), parsed.data.y * scaleDownFactor(), parsed.data.color); |
| 1253 | + if (floodfillUint8ClampedArray( |
| 1254 | + imageData.data, |
| 1255 | + parsed.data.x * scaleDownFactor(), |
| 1256 | + parsed.data.y * scaleDownFactor(), |
| 1257 | + parsed.data.color, |
| 1258 | + imageData.width, |
| 1259 | + imageData.height)) { |
| 1260 | + context.putImageData(imageData, 0, 0); |
| 1261 | + } |
1254 | 1262 | } else if (parsed.type === "clear-drawing-board") {
|
1255 | 1263 | clear(context);
|
1256 | 1264 | } else if (parsed.type === "next-turn") {
|
|
1766 | 1774 | .forEach(drawElement => {
|
1767 | 1775 | const drawData = drawElement.data;
|
1768 | 1776 | if (drawElement.type === "fill") {
|
1769 |
| - fillUint8ClampedArray( |
| 1777 | + floodfillUint8ClampedArray( |
1770 | 1778 | imageData.data,
|
1771 | 1779 | drawData.x * scaleFactor, drawData.y * scaleFactor,
|
1772 | 1780 | drawData.color,
|
|
2005 | 2013 | }, false);
|
2006 | 2014 |
|
2007 | 2015 | function fillAndSendEvent(context, x, y, color) {
|
2008 |
| - if (floodfillData(imageData.data, x, y, color, imageData.width, imageData.height)) { |
| 2016 | + if (floodfillUint8ClampedArray(imageData.data, x, y, color, imageData.width, imageData.height)) { |
2009 | 2017 | context.putImageData(imageData, 0, 0);
|
2010 | 2018 | const fillInstruction = {
|
2011 | 2019 | type: "fill",
|
|
0 commit comments