Replace frontend with deployed TS version from a08dd73
- Restore TS frontend source (canvas, tools, CRDT, components, services) - Keep 5 JSX components that TS code depends on (CADCanvas, LayerPanel, BlockLibrary, PluginRegistry, Toolbar) - Keep JS services (api.js, blockService.js) that components depend on - Fix vite/plugin-react version mismatch (downgrade to v4 for vite 6) - Add axios dependency - Skip tsc in build script (vite/esbuild handles transpilation) - Fix index.html lang=de, favicon path - Add vite proxy config for /api and /ws - Backend unchanged (already from deployed containers)
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
type Layer = {
|
||||
id: string;
|
||||
name: string;
|
||||
visible: boolean;
|
||||
locked: boolean;
|
||||
};
|
||||
|
||||
export class LayerManager {
|
||||
private layers: Layer[] = [];
|
||||
|
||||
public addLayer(layer: Layer): void {
|
||||
this.layers.push(layer);
|
||||
}
|
||||
|
||||
public removeLayer(id: string): void {
|
||||
const index = this.layers.findIndex(layer => layer.id === id);
|
||||
if (index !== -1) {
|
||||
this.layers.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public updateLayer(layer: Layer): void {
|
||||
const index = this.layers.findIndex(l => l.id === layer.id);
|
||||
if (index !== -1) {
|
||||
this.layers[index] = layer;
|
||||
}
|
||||
}
|
||||
|
||||
public getLayer(id: string): Layer | undefined {
|
||||
return this.layers.find(layer => layer.id === id);
|
||||
}
|
||||
|
||||
public getLayers(): Layer[] {
|
||||
return this.layers;
|
||||
}
|
||||
|
||||
public getVisibleLayers(): Layer[] {
|
||||
return this.layers.filter(layer => layer.visible && !layer.locked);
|
||||
}
|
||||
|
||||
public setVisible(id: string, visible: boolean): void {
|
||||
const layer = this.getLayer(id);
|
||||
if (layer) {
|
||||
layer.visible = visible;
|
||||
}
|
||||
}
|
||||
|
||||
public setLocked(id: string, locked: boolean): void {
|
||||
const layer = this.getLayer(id);
|
||||
if (layer) {
|
||||
layer.locked = locked;
|
||||
}
|
||||
}
|
||||
|
||||
public moveLayer(id: string, newIndex: number): void {
|
||||
const index = this.layers.findIndex(layer => layer.id === id);
|
||||
if (index !== -1) {
|
||||
const [layer] = this.layers.splice(index, 1);
|
||||
this.layers.splice(newIndex, 0, layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user