13a5e1eb7a
Lizenz: - AGPL-3.0 LICENSE-File im Repo-Root (GNU Volltext) - SPDX-Header + Copyright in allen Source-Files (Python/JSX/JS/Rust) - license-Feld in package.json + Cargo.toml - About-App komplett neu: Dual-Lizenz-Block (AGPL + Commercial), openbureau-Branding, Version-Pills, made-in-Switzerland-Footer UI-Restyle (3 Wellen) — alle Dialoge + Satellites + Panel-Sidebars auf gemeinsamen Pill-Stil aus BarControls (BarToggle/BarButton/BarCombo): - Welle 1: GeschossDialog/Settings, AusschnittSettings, LayoutDialog - Welle 2: ConfirmDeleteEbene, Kamera, MasseSettings, Osm, Swisstopo, TextEditor, AusschnittLayerDialog, LayerCombinations - Welle 3: LayoutsApp, MassstabApp, WerkzeugeApp, OverridesApp, ZeichnungsebenenApp; Werkzeuge mit ElementeApp-PillGroup-Layout GeschossDialog Header-Refactor: +Geschoss/+Zeichnung in Toolbar oben, move-Pfeile-Spalte breiter (kein Overlap mit G-Haken) Ausschnitte Rows als Pills, kein Outer-Border ums Suchfeld Section-Style komplett neu (gestaltung.py + GestaltungApp.jsx): - ObjectSectionAttributesSource.FromObject (richtiger Enum-Name fuer Mac) - HatchPatternPrintColor + BoundaryPrintColor mit-setzen (Display = Print) - BoundaryColor nur bei explizitem User-Override, sonst Rhino-Default - background_color_hex Parameter (BackgroundFillMode=SolidColor) - Readback aus GetCustomSectionStyle statt direkt aus Attributes - UI: Schnittkante > Section Style > Solid-Fill mit proper SectionHead - 'Boundary' (3D Pen) -> 'Background' weil sich's wie Section-Hintergrund verhaelt Plan-Mode 'Dossier Plan' via Template: - rhino/templates/dossier_plan.ini wird direkt geladen - Fallback auf Technical-Clone + ini-Patch wenn Template fehlt - Auto-Cleanup von Orphan-Modes vor Import (Name- oder Guid-Match) - ClipSectionUsage=1 + TechnicalMask=15 als bekannte Soll-Werte - Bei Template-Pfad keine ini-Patches (1:1 wie User exportiert) - Sanity-Print listet alle registrierten Modes nach Anlegen Bridge-Unification: 4 Settings-Apps (Ebenen/Project/Geschoss*Dialog) benutzen jetzt chunkende send() statt eigene bridgeSend ohne Chunk- Logik -> grosse Payloads (Hatch-Refs etc.) kommen nicht mehr truncated bei Python an (loeste 'JSON-Fehler char 990'-Regression in Ebenen- Settings) Library-Imports robust: 'import library' jetzt Top-Level in elemente.py + rhinopanel.py (statt Lazy in Methoden) -> 'No module named library'- Crashes weg auch wenn sys.path zwischendurch resettet wird Tools fuer Display-Mode-Maintenance: - _clean_display_modes.py (loescht alle Custom-Modes, Built-ins bleiben) - _inspect_plan_mode.py / _inspect_obj_section.py / _inspect_obj_boundary.py (Diagnose-Skripte fuer SectionStyle-Property-Reverse-Engineering) - _reset_rhino_settings.sh (Backup + Nuke der Rhino-Settings als letzte Bastion gegen korrupte Display-Modes)
91 lines
3.3 KiB
React
91 lines
3.3 KiB
React
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
// Copyright (C) 2026 Karim Gabriele Varano
|
|
import { useEffect, useRef, useState } from 'react'
|
|
import Icon from './Icon'
|
|
|
|
export default function ContextMenu({ x, y, items, onClose }) {
|
|
const ref = useRef(null)
|
|
const [pos, setPos] = useState({ left: x, top: y })
|
|
|
|
// Falls Menue rechts/unten ueberlaufen wuerde, links/oben verschieben
|
|
useEffect(() => {
|
|
if (!ref.current) return
|
|
const rect = ref.current.getBoundingClientRect()
|
|
const vw = window.innerWidth
|
|
const vh = window.innerHeight
|
|
let left = x, top = y
|
|
if (left + rect.width > vw - 4) left = vw - rect.width - 4
|
|
if (top + rect.height > vh - 4) top = vh - rect.height - 4
|
|
if (left < 4) left = 4
|
|
if (top < 4) top = 4
|
|
setPos({ left, top })
|
|
}, [x, y])
|
|
|
|
useEffect(() => {
|
|
const handleClick = (ev) => {
|
|
if (ref.current && !ref.current.contains(ev.target)) onClose()
|
|
}
|
|
const handleKey = (ev) => { if (ev.key === 'Escape') onClose() }
|
|
const handleContext = (ev) => { ev.preventDefault(); onClose() }
|
|
const t = setTimeout(() => {
|
|
document.addEventListener('mousedown', handleClick)
|
|
document.addEventListener('keydown', handleKey)
|
|
document.addEventListener('contextmenu', handleContext)
|
|
}, 0)
|
|
return () => {
|
|
clearTimeout(t)
|
|
document.removeEventListener('mousedown', handleClick)
|
|
document.removeEventListener('keydown', handleKey)
|
|
document.removeEventListener('contextmenu', handleContext)
|
|
}
|
|
}, [onClose])
|
|
|
|
return (
|
|
<div
|
|
ref={ref}
|
|
style={{
|
|
position: 'fixed',
|
|
top: pos.top, left: pos.left,
|
|
background: 'var(--bg-dialog)',
|
|
border: '1px solid var(--border)',
|
|
borderRadius: 'var(--r)',
|
|
boxShadow: 'var(--shadow-3)',
|
|
padding: '4px 0',
|
|
minWidth: 180,
|
|
zIndex: 300,
|
|
}}
|
|
>
|
|
{items.map((it, i) => (
|
|
it.divider ? (
|
|
<div key={i} style={{ height: 1, background: 'var(--border-light)', margin: '4px 0' }} />
|
|
) : (
|
|
<button
|
|
key={i}
|
|
disabled={it.disabled}
|
|
onClick={() => { if (!it.disabled) { it.onClick(); onClose() } }}
|
|
onMouseEnter={(ev) => { if (!it.disabled) ev.currentTarget.style.background = 'var(--overlay-hover)' }}
|
|
onMouseLeave={(ev) => { ev.currentTarget.style.background = 'transparent' }}
|
|
style={{
|
|
width: '100%', textAlign: 'left',
|
|
padding: '6px 14px', fontSize: 11,
|
|
color: it.disabled ? 'var(--text-muted)'
|
|
: it.danger ? 'var(--danger)'
|
|
: 'var(--text-primary)',
|
|
display: 'flex', alignItems: 'center', gap: 10,
|
|
borderRadius: 0,
|
|
cursor: it.disabled ? 'default' : 'pointer',
|
|
background: 'transparent',
|
|
}}
|
|
>
|
|
{it.icon
|
|
? <Icon name={it.icon} size={14} style={{ color: it.disabled ? 'var(--text-muted)' : it.danger ? 'var(--danger)' : 'var(--text-secondary)' }} />
|
|
: <span style={{ width: 14 }} />}
|
|
<span style={{ flex: 1 }}>{it.label}</span>
|
|
{it.shortcut && <span style={{ fontSize: 9, color: 'var(--text-muted)', fontFamily: 'var(--font-mono)' }}>{it.shortcut}</span>}
|
|
</button>
|
|
)
|
|
))}
|
|
</div>
|
|
)
|
|
}
|