fix: sidebar collapse + responsive tool grid + remove zoom tool
This commit is contained in:
@@ -1540,7 +1540,7 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
|
||||
selectedTemplate={selectedTemplate}
|
||||
onTemplateSelect={handleTemplateSelect}
|
||||
className={mobileLeftOpen ? 'open' : ''}
|
||||
onCollapse={() => setMobileLeftOpen(false)}
|
||||
onCollapse={() => { setMobileLeftOpen(false); setLeftSidebarCollapsed(true); }}
|
||||
collapsed={leftSidebarCollapsed}
|
||||
onToggleCollapse={() => setLeftSidebarCollapsed((p) => !p)}
|
||||
blocks={blocks}
|
||||
|
||||
@@ -13,7 +13,6 @@ interface ToolDef {
|
||||
const sectionAuswahlen: ToolDef[] = [
|
||||
{ tool: 'select', title: 'Auswählen (V)', label: 'Auswahl', kbd: 'V', svg: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg> },
|
||||
{ tool: 'pan', title: 'Pan (P / Leertaste)', label: 'Pan', kbd: 'P', svg: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"><path d="M18 11V6a2 2 0 0 0-2-2 2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2 2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2 2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg> },
|
||||
{ tool: 'zoom-win', title: 'Zoom-Fenster (Z)', label: 'Zoom', kbd: 'Z', svg: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><line x1="7" y1="12" x2="17" y2="12"/></svg> },
|
||||
{ tool: 'measure', title: 'Messen', label: 'Messen', kbd: 'M', svg: <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M21.3 8.7 8.7 21.3a1 1 0 0 1-1.4 0L2.7 16.7a1 1 0 0 1 0-1.4L15.3 2.7a1 1 0 0 1 1.4 0l4.6 4.6a1 1 0 0 1 0 1.4z"/><path d="m7.5 10.5 2 2"/><path d="m10.5 7.5 2 2"/></svg> },
|
||||
];
|
||||
|
||||
|
||||
@@ -293,9 +293,6 @@ export class InteractionEngine {
|
||||
case 'hatch':
|
||||
this.handleHatchDown(final);
|
||||
break;
|
||||
case 'zoom-win':
|
||||
this.handleZoomWinDown(final);
|
||||
break;
|
||||
case 'measure':
|
||||
this.handleMeasureDown(final);
|
||||
break;
|
||||
@@ -669,25 +666,6 @@ export class InteractionEngine {
|
||||
this.requestRender();
|
||||
}
|
||||
|
||||
private handleZoomWinDown(pt: { x: number; y: number }): void {
|
||||
// Zoom window: two clicks define the zoom area
|
||||
if (this.state.points.length === 0) {
|
||||
this.state.points.push(pt);
|
||||
this.state.phase = 'drawing';
|
||||
this.onCommandTrigger?.('zoom: click opposite corner');
|
||||
} else {
|
||||
const first = this.state.points[0];
|
||||
const minX = Math.min(first.x, pt.x);
|
||||
const minY = Math.min(first.y, pt.y);
|
||||
const maxX = Math.max(first.x, pt.x);
|
||||
const maxY = Math.max(first.y, pt.y);
|
||||
this.zoomPan.zoomToRect({ minX, minY, maxX, maxY });
|
||||
this.state.points = [];
|
||||
this.state.phase = 'idle';
|
||||
this.requestRender();
|
||||
}
|
||||
}
|
||||
|
||||
private handleMeasureDown(pt: { x: number; y: number }): void {
|
||||
// Measure: two clicks, display distance
|
||||
if (this.state.points.length === 0) {
|
||||
@@ -1084,7 +1062,6 @@ export class InteractionEngine {
|
||||
};
|
||||
break;
|
||||
}
|
||||
case 'zoom-win':
|
||||
case 'measure': {
|
||||
// Show a dashed line preview from first point to cursor
|
||||
this.state.previewElement = {
|
||||
|
||||
@@ -520,7 +520,7 @@ a:hover { text-decoration: underline; }
|
||||
}
|
||||
.tool-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
|
||||
gap: 4px;
|
||||
}
|
||||
.tool-btn {
|
||||
@@ -1197,7 +1197,7 @@ a:hover { text-decoration: underline; }
|
||||
}
|
||||
/* Tools collapse to icon-only on tablet */
|
||||
.leftbar-title, .tool-section-label, .tool-btn-label { display: none; }
|
||||
.tool-grid { grid-template-columns: 1fr 1fr; gap: 2px; }
|
||||
.tool-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 2px; }
|
||||
.tool-btn { padding: 10px 4px; }
|
||||
.leftbar-header { justify-content: center; padding: 6px; }
|
||||
.leftbar-toggle { display: none; }
|
||||
@@ -1318,7 +1318,7 @@ a:hover { text-decoration: underline; }
|
||||
.leftbar-title { display: block; }
|
||||
.tool-section-label { display: block; padding: 0 6px 6px; }
|
||||
.tool-btn-label { display: block; }
|
||||
.tool-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
|
||||
.tool-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; }
|
||||
.rightbar { overflow-y: auto; -webkit-overflow-scrolling: touch; }}
|
||||
|
||||
/* Right tab bar (vertical icon bar, ALWAYS visible on mobile) */
|
||||
@@ -1429,7 +1429,7 @@ a:hover { text-decoration: underline; }
|
||||
/* Left drawer content: tool palette */
|
||||
.drawer-left .drawer-body { padding: var(--spacing-sm); }
|
||||
.drawer-left .tool-section { padding: 8px; }
|
||||
.drawer-left .tool-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
|
||||
.drawer-left .tool-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px; }
|
||||
.drawer-left .tool-btn { padding: 10px 4px; }
|
||||
.drawer-left .tool-btn-kbd { display: none; }
|
||||
.drawer-left .tool-btn-label { display: block; }
|
||||
|
||||
@@ -111,7 +111,7 @@ export interface ExportResult {
|
||||
}
|
||||
|
||||
export type ToolType =
|
||||
| 'select' | 'pan' | 'zoom-win' | 'line' | 'polyline' | 'circle' | 'arc'
|
||||
| 'select' | 'pan' | 'line' | 'polyline' | 'circle' | 'arc'
|
||||
| 'rect' | 'polygon' | 'text' | 'dimension' | 'hatch'
|
||||
| 'move' | 'copy' | 'rotate' | 'scale' | 'mirror'
|
||||
| 'trim' | 'extend' | 'fillet' | 'offset'
|
||||
|
||||
Reference in New Issue
Block a user