Fix U-shape logic in createKlasseTemplate to be open at bottom, not hollow rectangle
This commit is contained in:
@@ -71,7 +71,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_table_' + i,
|
||||
id: crypto.randomUUID() + '_table_' + i,
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: tableX,
|
||||
@@ -88,7 +88,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Top side chairs
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_chair_top_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_chair_top_' + i + '_' + j,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: tableX + positionRatio * tableWidth - chairWidth / 2,
|
||||
@@ -100,7 +100,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Bottom side chairs
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_chair_bottom_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_chair_bottom_' + i + '_' + j,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: tableX + positionRatio * tableWidth - chairWidth / 2,
|
||||
@@ -126,7 +126,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create round table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_table_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_table_' + i + '_' + j,
|
||||
type: 'round_table',
|
||||
layerId: 'default',
|
||||
x: tableX - tableRadius,
|
||||
@@ -148,7 +148,7 @@ class SeatingTemplateTool extends Tool {
|
||||
const chairY = tableY + (tableRadius + this.chairSpacing) * Math.sin(angle) - 22.5;
|
||||
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_chair_' + i + '_' + j + '_' + k,
|
||||
id: crypto.randomUUID() + '_chair_' + i + '_' + j + '_' + k,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: chairX,
|
||||
@@ -176,7 +176,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_table_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_table_' + i + '_' + j,
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: tableX,
|
||||
@@ -198,7 +198,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create main table (president's table)
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_main_table',
|
||||
id: crypto.randomUUID() + '_main_table',
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: x + tableWidth / 2,
|
||||
@@ -213,7 +213,7 @@ class SeatingTemplateTool extends Tool {
|
||||
for (let i = 0; i < sideTablesCount; i++) {
|
||||
// Left side table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_left_table_' + i,
|
||||
id: crypto.randomUUID() + '_left_table_' + i,
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: x,
|
||||
@@ -225,7 +225,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Right side table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_right_table_' + i,
|
||||
id: crypto.randomUUID() + '_right_table_' + i,
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: x + tableWidth + tableWidth / 2,
|
||||
@@ -238,7 +238,7 @@ class SeatingTemplateTool extends Tool {
|
||||
// Create chairs for side tables
|
||||
// Left side chairs
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_left_chair_' + i,
|
||||
id: crypto.randomUUID() + '_left_chair_' + i,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: x - this.chairSpacing - chairWidth,
|
||||
@@ -250,7 +250,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Right side chairs
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_right_chair_' + i,
|
||||
id: crypto.randomUUID() + '_right_chair_' + i,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: x + tableWidth + tableWidth / 2 + tableWidth / 2 + this.chairSpacing,
|
||||
@@ -262,7 +262,7 @@ class SeatingTemplateTool extends Tool {
|
||||
}
|
||||
}
|
||||
|
||||
// Create Klasse template (U-shape classroom layout)
|
||||
// Create Klasse template (U-shape classroom layout open at bottom)
|
||||
private createKlasseTemplate(x: number, y: number): void {
|
||||
const tableWidth = 120;
|
||||
const tableHeight = 60;
|
||||
@@ -271,7 +271,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create teacher's table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_teacher_table',
|
||||
id: crypto.randomUUID() + '_teacher_table',
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: x + tableWidth,
|
||||
@@ -281,13 +281,14 @@ class SeatingTemplateTool extends Tool {
|
||||
properties: {}
|
||||
});
|
||||
|
||||
// Create student tables in U-shape
|
||||
// Create student tables in U-shape (open at bottom)
|
||||
const rows = 4;
|
||||
const cols = 5;
|
||||
|
||||
for (let i = 0; i < rows; i++) {
|
||||
for (let j = 0; j < cols; j++) {
|
||||
// Skip center tables to create U-shape
|
||||
// Create U-shape that is open at the bottom
|
||||
// Skip inner tables but keep the bottom row
|
||||
if (i > 0 && i < rows - 1 && j > 0 && j < cols - 1) continue;
|
||||
|
||||
const tableX = x + j * (tableWidth + this.tableSpacing);
|
||||
@@ -295,7 +296,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_student_table_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_student_table_' + i + '_' + j,
|
||||
type: 'rectangular_table',
|
||||
layerId: 'default',
|
||||
x: tableX,
|
||||
@@ -307,7 +308,7 @@ class SeatingTemplateTool extends Tool {
|
||||
|
||||
// Create chair behind each table
|
||||
this.yjsDoc.createElement({
|
||||
id: Date.now().toString() + '_student_chair_' + i + '_' + j,
|
||||
id: crypto.randomUUID() + '_student_chair_' + i + '_' + j,
|
||||
type: 'chair',
|
||||
layerId: 'default',
|
||||
x: tableX + tableWidth / 2 - chairWidth / 2,
|
||||
|
||||
Reference in New Issue
Block a user