[121] Neurendern: Panels lesen Projekt und Objekt-Info selbst aus dem Store (useSelectionInfo, inhaltlich stabil), Panel-Host ohne project/selection/contextObjects und mit stabiler Identität (Handler als Trampoline), usePanelHostBase in src/state/panelHost/ zerlegt; Docks, versteckte Datei-Felder, Zeichnungs-Reiter und Präsentations-Dialog memoisiert; Wand-Änderung 55 → 42 Renders, Schranken im e2e gesenkt; Doku und TODO nachgeführt
This commit is contained in:
48 files changed
+1981
-1711
No files matched your search
@@ -1,16 +1,17 @@
|
||||
// Versteckte Datei-Felder der App ([163], aus App.tsx herausgelöst): DXF/DWG/IFC/PDF, STEP, IFC,
|
||||
// Bild/PDF, Projektdatei und Vorlage, dazu die Hosts für Punktwolken- und Mesh-Import. Menüs, Befehle
|
||||
// und Werkzeuge öffnen den Dateidialog über die Refs (`ref.current.click()`); die gewählte Datei geht
|
||||
// an den jeweiligen Handler. Gerendert von `App.tsx` ganz oben im Editor.
|
||||
// an den jeweiligen Handler. Gerendert von `App.tsx` ganz oben im Editor; memoisiert ([121]), die
|
||||
// Handler kommen mit stabiler Identität aus dem Handler-Bündel der App.
|
||||
|
||||
import type { RefObject } from "react";
|
||||
import { memo, type RefObject } from "react";
|
||||
import { PROJECT_TEMPLATE_EXT } from "../native/projectFile";
|
||||
import type { MeshPlacement, MeshRead } from "../io/meshImport";
|
||||
import { MeshImportHost } from "./MeshImportDialog";
|
||||
import { PointCloudImportHost } from "./PointCloudImportDialog";
|
||||
import type { NotifyKind } from "../state/notifySlice";
|
||||
|
||||
export function HiddenFileInputs(props: {
|
||||
export const HiddenFileInputs = memo(function HiddenFileInputs(props: {
|
||||
dxfInputRef: RefObject<HTMLInputElement>;
|
||||
stepInputRef: RefObject<HTMLInputElement>;
|
||||
ifcInputRef: RefObject<HTMLInputElement>;
|
||||
@@ -123,4 +124,4 @@ export function HiddenFileInputs(props: {
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
// Layouts-Panel ihn öffnen. Beim Bestätigen entsteht das Blatt in EINEM Undo-Schritt
|
||||
// (`state/presentationSheet.ts`); `onCreated` öffnet es. Overlay wie `LayoutCreateDialogs` (kein window.prompt).
|
||||
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { memo, useCallback, useEffect, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { presentationDefaults, type PresentationOptions } from "../core";
|
||||
import type { LayoutOrientation, LayoutPaperFormat } from "../model/types";
|
||||
@@ -12,9 +12,14 @@ import { getState, useStore } from "../state/appStore";
|
||||
import { setPresentationDialogOpener } from "../state/presentationSheetHook";
|
||||
import { createPresentationSheet } from "../state/presentationSheet";
|
||||
|
||||
export function PresentationDialogHost({ onCreated }: { onCreated: (layoutId: string) => void }) {
|
||||
/** Memoisiert und nur auf die Zeichnungsebenen abonniert ([121]): rendert nicht bei jeder Op. */
|
||||
export const PresentationDialogHost = memo(function PresentationDialogHost({
|
||||
onCreated,
|
||||
}: {
|
||||
onCreated: (layoutId: string) => void;
|
||||
}) {
|
||||
const [opts, setOpts] = useState<PresentationOptions | null>(null);
|
||||
const project = useStore((s) => s.project);
|
||||
const drawingLevels = useStore((s) => s.project.drawingLevels);
|
||||
|
||||
useEffect(() => {
|
||||
setPresentationDialogOpener(() => setOpts(presentationDefaults(getState().project)));
|
||||
@@ -42,9 +47,9 @@ export function PresentationDialogHost({ onCreated }: { onCreated: (layoutId: st
|
||||
}, [opts, close, confirm]);
|
||||
|
||||
if (!opts) return null;
|
||||
const floors = project.drawingLevels.filter((l) => l.kind === "floor" && !l.layoutId);
|
||||
const sections = project.drawingLevels.filter((l) => l.kind === "section");
|
||||
const hasElevations = project.drawingLevels.some((l) => l.kind === "elevation");
|
||||
const floors = drawingLevels.filter((l) => l.kind === "floor" && !l.layoutId);
|
||||
const sections = drawingLevels.filter((l) => l.kind === "section");
|
||||
const hasElevations = drawingLevels.some((l) => l.kind === "elevation");
|
||||
const set = (patch: Partial<PresentationOptions>) => setOpts({ ...opts, ...patch });
|
||||
const toggleFloor = (id: string, on: boolean) =>
|
||||
// Blattreihenfolge = Reihenfolge der Geschosse im Projekt.
|
||||
@@ -162,4 +167,4 @@ export function PresentationDialogHost({ onCreated }: { onCreated: (layoutId: st
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user