Skip to content

Commit 943230e

Browse files
committed
Stamps are finally working like other strokes
1 parent e630c21 commit 943230e

1 file changed

Lines changed: 0 additions & 42 deletions

File tree

frontend/src/components/Canvas.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ function Canvas({
490490
const handleStrokeUndone = (data) => {
491491
console.log("Stroke undone event received:", data);
492492

493-
// CRITICAL: Force next redraw to bypass signature check
494493
forceNextRedrawRef.current = true;
495494
lastDrawnStateRef.current = null;
496495

@@ -805,24 +804,6 @@ function Canvas({
805804

806805
stampDrawing.roomId = currentRoomId;
807806

808-
// Debug: Log the stamp drawing to verify structure
809-
console.log("=== PLACING STAMP DEBUG ===");
810-
console.log("Stamp Drawing object:", stampDrawing);
811-
console.log("pathData:", stampDrawing.pathData);
812-
console.log("pathData is array:", Array.isArray(stampDrawing.pathData));
813-
console.log("pathData length:", stampDrawing.pathData ? stampDrawing.pathData.length : 0);
814-
console.log("stampData:", stampDrawing.stampData);
815-
console.log("stampSettings:", stampDrawing.stampSettings);
816-
console.log("metadata:", stampDrawing.getMetadata());
817-
818-
// CRITICAL: Log stamp data size for debugging
819-
if (stamp.image) {
820-
console.log("Custom image stamp - base64 length:", stamp.image.length);
821-
console.log("Base64 preview:", stamp.image.substring(0, 100) + "...");
822-
} else if (stamp.emoji) {
823-
console.log("Emoji stamp:", stamp.emoji);
824-
}
825-
826807
userData.addDrawing(stampDrawing);
827808
setPendingDrawings((prev) => [...prev, stampDrawing]);
828809

@@ -1218,9 +1199,6 @@ function Canvas({
12181199
const savedBrushType = brushEngine ? brushEngine.brushType : null;
12191200
const savedBrushParams = brushEngine ? brushEngine.brushParams : null;
12201201

1221-
// Debug: Check if brushEngine is available
1222-
console.log("[drawAllDrawings] brushEngine available:", !!brushEngine, "has drawWithType:", !!(brushEngine && brushEngine.drawWithType));
1223-
12241202
try {
12251203
setIsLoading(true);
12261204
const canvas = canvasRef.current;
@@ -1282,7 +1260,6 @@ function Canvas({
12821260
offscreenContext.imageSmoothingEnabled = false;
12831261
offscreenContext.clearRect(0, 0, canvasWidth, canvasHeight);
12841262

1285-
// CRITICAL: Array to collect stamps for batch rendering
12861263
// This avoids async rendering issues with image stamps
12871264
const stampsToRender = [];
12881265

@@ -1380,22 +1357,6 @@ function Canvas({
13801357
const maskedOriginals = new Set();
13811358
let seenAnyCut = false;
13821359

1383-
// Debug: Count brush types
1384-
const brushTypeCounts = {};
1385-
sortedDrawings.forEach(d => {
1386-
const bt = d.brushType || "unknown";
1387-
brushTypeCounts[bt] = (brushTypeCounts[bt] || 0) + 1;
1388-
});
1389-
console.log("[drawAllDrawings] Brush type counts:", brushTypeCounts, "Total drawings:", sortedDrawings.length);
1390-
1391-
// Debug: Log all drawing IDs and types being rendered
1392-
console.log("[drawAllDrawings] Rendering strokes:", sortedDrawings.map(d => ({
1393-
id: d.drawingId,
1394-
type: d.drawingType || "stroke",
1395-
brushType: d.brushType || "normal",
1396-
hasParentPasteId: !!(d.parentPasteId || (d.pathData && d.pathData.parentPasteId))
1397-
})));
1398-
13991360
for (const drawing of sortedDrawings) {
14001361
// If this is a cut record, apply the erase to the canvas now.
14011362
if (drawing && drawing.pathData && drawing.pathData.tool === "cut") {
@@ -1494,7 +1455,6 @@ function Canvas({
14941455
position: drawing.pathData[0]
14951456
});
14961457
} else if (drawing.drawingType === "stamp") {
1497-
// Debug: Log why stamp is not being rendered
14981458
console.warn("[drawAllDrawings] Stamp NOT rendered - missing requirements:", {
14991459
drawingId: drawing.drawingId,
15001460
drawingType: drawing.drawingType,
@@ -2091,7 +2051,6 @@ function Canvas({
20912051
}
20922052
} catch (e) { }
20932053

2094-
// CRITICAL: For undo/redo events, force a complete state reset
20952054
if (sourceLabel === "undo-event" || sourceLabel === "redo-event") {
20962055
console.log("[mergedRefreshCanvas] Forcing complete state reset for undo/redo");
20972056
lastDrawnStateRef.current = null;
@@ -2190,7 +2149,6 @@ function Canvas({
21902149
userData.drawings.push(pd);
21912150
stillPending.push(pd);
21922151
} else {
2193-
// CRITICAL FIX: For stamps and advanced drawings, verify backend version has complete metadata
21942152
// If pending drawing has stampData but backend version doesn't, use pending version
21952153
if (pd.drawingType === "stamp" && pd.stampData) {
21962154
const backendMatch = exists;

0 commit comments

Comments
 (0)