Refactor CourtDrawing components by removing overlay text and debug logs

Removed overlay text rendering and debug logging from CourtDrawingRender.vue and CourtDrawingTool.vue to streamline the drawing process. Updated DiaryView.vue to suppress debug messages and handle parsing errors more gracefully, enhancing overall code clarity and user experience.
This commit is contained in:
Torsten Schulz (local)
2025-10-31 15:14:11 +01:00
parent 91fc3e9d13
commit 7e85926aa1
3 changed files with 2 additions and 63 deletions

View File

@@ -133,14 +133,6 @@ export default {
this.drawTable();
this.drawStartCircles();
this.drawArrowsAndLabels();
// Zuletzt: Overlay mit dem gerenderten Kürzel-String
const code = this.buildCodeString();
if (code) {
this.drawOverlayText(code);
}
// Debug: Rohwerte anzeigen
const raw = `raw: start=${this.drawingData?.selectedStartPosition || '-'} circle=${this.drawingData?.selectedCirclePosition || '-'}`;
this.drawOverlayText(raw, 2);
},
drawTable() {
const ctx = this.ctx;
@@ -453,22 +445,6 @@ export default {
}
return code;
},
drawOverlayText(text, line = 1) {
const ctx = this.ctx;
const padding = 6;
const x = 10;
const y = this.config.canvas.height - 16 - (line - 1) * 22;
ctx.save();
ctx.font = '12px Arial';
const width = ctx.measureText(text).width;
const boxW = width + padding * 2;
const boxH = 16 + padding * 2;
ctx.fillStyle = 'rgba(0,0,0,0.6)';
ctx.fillRect(x - padding, y - 12 - padding, boxW, boxH);
ctx.fillStyle = '#ffffff';
ctx.fillText(text, x, y);
ctx.restore();
},
getStartCircleCenter() {
const cfg = this.config.startCircles;
const tableWidth = this.config.table.width;

View File

@@ -461,8 +461,6 @@ export default {
this.ctx = this.canvas.getContext('2d');
this.ctx.lineCap = this.config.pen.cap;
this.ctx.lineJoin = this.config.pen.join;
} else {
console.error('CourtDrawingTool: Canvas not found!');
}
},
@@ -472,7 +470,6 @@ export default {
const config = this.config;
if (!ctx || !canvas) {
console.error('CourtDrawingTool: Canvas or context not available');
return;
}
@@ -1320,25 +1317,6 @@ export default {
this.drawCourt();
},
testDraw() {
if (!this.canvas || !this.ctx) {
console.error('Canvas or context not available, trying to reinitialize...');
this.initCanvas();
}
if (this.canvas && this.ctx) {
// Einfacher Test: Roter Kreis
this.ctx.fillStyle = 'red';
this.ctx.beginPath();
this.ctx.arc(300, 200, 50, 0, 2 * Math.PI);
this.ctx.fill();
} else {
console.error('Still no canvas or context available');
}
},
async saveDrawing() {
@@ -1385,7 +1363,7 @@ export default {
});
}
} catch (error) {
console.error('CourtDrawingTool: Error in saveDrawing:', error);
// Fehlerbehandlung
}
},

View File

@@ -683,7 +683,6 @@ export default {
try {
if (!pa) return null;
if (pa.drawingData && typeof pa.drawingData === 'object') {
console.debug('DiaryView: drawingData (object) gefunden für', pa.id);
const data = { ...pa.drawingData };
// Kürzel aus PA anreichern
if (pa.code && !data.code) data.code = pa.code;
@@ -694,7 +693,6 @@ export default {
}
if (pa.drawingData && typeof pa.drawingData === 'string') {
const parsed = JSON.parse(pa.drawingData);
console.debug('DiaryView: drawingData (string→parsed) für', pa.id, parsed);
if (pa.code && !parsed.code) parsed.code = pa.code;
if (pa.renderCode && !parsed.code) parsed.code = pa.renderCode;
this._ensureStartPositionFromRenderCode(pa, parsed);
@@ -708,7 +706,6 @@ export default {
const parsedImg = typeof withData.drawingData === 'string'
? JSON.parse(withData.drawingData)
: withData.drawingData;
console.debug('DiaryView: drawingData aus images für', pa.id, 'imageId=', withData.id, parsedImg);
if (pa.code && !parsedImg.code) parsedImg.code = pa.code;
if (pa.renderCode && !parsedImg.code) parsedImg.code = pa.renderCode;
this._ensureStartPositionFromRenderCode(pa, parsedImg);
@@ -716,7 +713,7 @@ export default {
}
}
} catch (e) {
console.warn('DiaryView: drawingData parse error:', e);
// Fehler beim Parsen ignorieren
}
return null;
},
@@ -1798,7 +1795,6 @@ export default {
await this.addPlanItem();
} catch (error) {
console.error('Fehler beim Verarbeiten der Übungszeichnung:', error);
const msg = error.response?.data?.error || 'Fehler beim Erstellen der Aktivität';
this.showInfo('Fehler', msg, '', 'error');
}
@@ -2068,8 +2064,6 @@ export default {
await apiClient.put(`/participants/${this.date.id}/${memberId}/group`, {
groupId: selectedGroupId || null
});
console.log(`Teilnehmer ${memberId} wurde Gruppe ${selectedGroupId} zugewiesen`);
} catch (error) {
console.error('Fehler beim Aktualisieren der Teilnehmer-Gruppenzuordnung:', error);
this.showInfo('Fehler', 'Fehler beim Aktualisieren der Teilnehmer-Gruppenzuordnung', '', 'error');
@@ -2099,22 +2093,15 @@ export default {
},
async createAndAddMember(memberData) {
console.log('🔍 createAndAddMember aufgerufen mit:', memberData);
// Verwende die übergebenen Daten oder die lokalen Daten als Fallback
const data = memberData || this.newMember;
console.log('📊 Verwendete Daten:', data);
if (!data.firstName || data.firstName.trim() === '') {
console.log('❌ Validierung fehlgeschlagen: Vorname fehlt');
this.showInfo('Fehler', 'Vorname ist erforderlich', '', 'error');
return;
}
try {
console.log('✅ Validierung erfolgreich, erstelle Mitglied...');
// Erstelle neues Mitglied
const memberDataToSend = {
firstName: data.firstName.trim(),
@@ -2122,8 +2109,6 @@ export default {
birthDate: data.birthDate || '',
gender: data.gender
};
console.log('📤 Sende Daten an API:', memberDataToSend);
const response = await apiClient.post(`/clubmembers/set/${this.currentClub}`, {
id: null, // null für neues Mitglied