изменил внешний вид сайдбара на то что схоже с

с меню навигации
This commit is contained in:
Georgy Shive 2025-05-29 22:28:14 +07:00
parent e8f2a29267
commit 50a7609cf1
3 changed files with 604 additions and 599 deletions

View File

@ -1,75 +1,200 @@
/* Стили для React-компонента сайдбара */
.potree-sidebar-react {
width: 100%;
height: 100%;
background: rgba(142, 152, 168, 1);
color: white;
font-family: Arial, sans-serif;
font-size: 14px;
overflow-y: auto;
/* Панель настроек */
.sidebar-panel {
position: fixed;
left: 20px;
top: 50%;
transform: translateY(-50%);
z-index: 2000;
}
/* Заголовок сайдбара */
.sidebar-header {
padding: 15px;
background: rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
/* Кнопка-триггер */
.sidebar-trigger {
width: 50px;
height: 50px;
border-radius: 50%;
background: rgba(76, 175, 80, 0.9);
border: none;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.sidebar-trigger:hover {
background: rgba(76, 175, 80, 1);
transform: scale(1.1);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.sidebar-trigger.active {
background: rgba(76, 175, 80, 1);
transform: scale(1.05);
}
.sidebar-trigger img {
transition: transform 0.3s ease;
}
.sidebar-trigger.active img {
transform: rotate(180deg);
}
/* Оверлей */
.sidebar-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: transparent;
z-index: 1999;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
/* Попап с настройками */
.sidebar-popup {
position: absolute;
left: 60px;
top: 50%;
transform: translateY(-50%);
background: rgba(142, 152, 168, 0.95);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.2);
min-width: 320px;
max-width: 380px;
max-height: 80vh;
animation: slideInLeft 0.3s ease;
z-index: 2001;
overflow: hidden;
}
@keyframes slideInLeft {
from {
opacity: 0;
transform: translateY(-50%) translateX(-20px);
}
to {
opacity: 1;
transform: translateY(-50%) translateX(0);
}
}
/* Заголовок попапа */
.sidebar-popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 20px;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
background: rgba(0, 0, 0, 0.3);
border-radius: 12px 12px 0 0;
}
.sidebar-brand a {
color: #4CAF50;
text-decoration: none;
font-weight: bold;
.sidebar-popup-header h3 {
margin: 0;
color: white;
font-size: 16px;
font-weight: bold;
}
.sidebar-brand a:hover {
color: #5CBF60;
.sidebar-close {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.2s ease;
}
.sidebar-version {
color: #9AA1A4;
font-size: 12px;
font-weight: 100;
.sidebar-close:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale(1.1);
}
/* Содержимое сайдбара */
.sidebar-content {
/* Содержимое попапа */
.sidebar-popup-content {
padding: 0;
max-height: calc(80vh - 60px);
overflow-y: auto;
}
/* Секции сайдбара */
/* Секции настроек */
.sidebar-section {
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-section:last-child {
border-bottom: none;
}
.section-header {
background: rgba(0, 0, 0, 0.8);
background: rgba(0, 0, 0, 0.4);
color: white;
padding: 12px 15px;
padding: 15px 20px;
margin: 0;
cursor: pointer;
font-size: 14px;
font-weight: bold;
border: none;
transition: background-color 0.2s ease;
transition: all 0.2s ease;
user-select: none;
width: 100%;
text-align: left;
display: flex;
justify-content: space-between;
align-items: center;
}
.section-header:hover {
background: rgba(0, 0, 0, 0.9);
background: rgba(76, 175, 80, 0.3);
}
.section-header.active {
background: rgba(0, 0, 0, 0.9);
background: rgba(76, 175, 80, 0.4);
}
.section-arrow {
font-size: 12px;
transition: transform 0.2s ease;
color: #4CAF50;
}
.section-content {
padding: 15px;
padding: 20px;
background: rgba(122, 132, 148, 0.9);
animation: slideDown 0.3s ease;
}
@keyframes slideDown {
from {
opacity: 0;
max-height: 0;
padding-top: 0;
padding-bottom: 0;
}
to {
opacity: 1;
max-height: 1000px;
padding-top: 20px;
padding-bottom: 20px;
}
}
/* Разделители */
@ -186,17 +311,17 @@
/* Сетка инструментов */
.tools-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
gap: 8px;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
margin-bottom: 15px;
}
.tool-button {
width: 40px;
height: 40px;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
border-radius: 8px;
cursor: pointer;
display: flex;
align-items: center;
@ -205,142 +330,104 @@
}
.tool-button:hover {
background: rgba(0, 0, 0, 0.5);
background: rgba(76, 175, 80, 0.3);
border-color: #4CAF50;
transform: scale(1.05);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.tool-button img {
width: 24px;
height: 24px;
filter: brightness(0) invert(1);
transition: filter 0.2s ease;
}
.tool-button:hover img {
filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(90deg);
}
/* Кнопки экспорта */
.export-buttons {
display: flex;
gap: 10px;
margin-bottom: 15px;
/* Скроллбар для содержимого попапа */
.sidebar-popup-content::-webkit-scrollbar {
width: 6px;
}
.export-btn {
width: 32px;
height: 32px;
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.export-btn:hover {
background: rgba(0, 0, 0, 0.5);
border-color: #4CAF50;
}
.export-btn img {
width: 20px;
height: 20px;
filter: brightness(0) invert(1);
}
/* Дерево сцены */
.scene-tree {
.sidebar-popup-content::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
padding: 10px;
margin-bottom: 15px;
border-radius: 3px;
}
.tree-item {
padding: 5px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
cursor: pointer;
transition: color 0.2s ease;
.sidebar-popup-content::-webkit-scrollbar-thumb {
background: rgba(76, 175, 80, 0.6);
border-radius: 3px;
}
.tree-item:hover {
color: #4CAF50;
.sidebar-popup-content::-webkit-scrollbar-thumb:hover {
background: rgba(76, 175, 80, 0.8);
}
.tree-item:last-child {
border-bottom: none;
}
/* Список классификации */
.classification-list {
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
padding: 10px;
}
/* Адаптивность */
/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
.potree-sidebar-react {
font-size: 12px;
.sidebar-panel {
left: 10px;
}
.sidebar-header {
padding: 10px;
.sidebar-trigger {
width: 45px;
height: 45px;
}
.sidebar-popup {
min-width: 280px;
max-width: calc(100vw - 80px);
left: 55px;
}
.sidebar-popup-header {
padding: 12px 15px;
}
.section-content {
padding: 10px;
padding: 15px;
}
.tools-grid {
grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
gap: 6px;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.tool-button {
width: 35px;
height: 35px;
width: 45px;
height: 45px;
}
.tool-button img {
width: 20px;
height: 20px;
}
}
/* Анимации */
.section-content {
animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
from {
opacity: 0;
max-height: 0;
@media (max-width: 480px) {
.sidebar-popup {
position: fixed;
left: 10px;
right: 10px;
top: 10px;
bottom: 10px;
transform: none;
max-width: none;
max-height: none;
animation: slideInUp 0.3s ease;
}
to {
opacity: 1;
max-height: 1000px;
@keyframes slideInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
}
/* Скроллбар */
.potree-sidebar-react::-webkit-scrollbar {
width: 8px;
}
.potree-sidebar-react::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}
.potree-sidebar-react::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 4px;
}
.potree-sidebar-react::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}

View File

@ -1,470 +1,420 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import './PotreeSidebar.css';
// Простое объявление типов для избежания конфликтов
declare const window: any;
interface SidebarProps {
interface PotreeSidebarProps {
viewer?: any;
}
const PotreeSidebar: React.FC<SidebarProps> = ({ viewer }) => {
const [activeSection, setActiveSection] = useState<string>('appearance');
const PotreeSidebar: React.FC<PotreeSidebarProps> = ({ viewer }) => {
const [isOpen, setIsOpen] = useState(false);
const [activeSection, setActiveSection] = useState<string | null>(null);
// Состояния для различных настроек
const [pointSize, setPointSize] = useState(1);
const [pointBudget, setPointBudget] = useState(1000000);
const [fov, setFov] = useState(60);
const [edlEnabled, setEdlEnabled] = useState(false);
const [edlRadius, setEdlRadius] = useState(1.4);
const [edlStrength, setEdlStrength] = useState(0.4);
const [edlOpacity, setEdlOpacity] = useState(1.0);
const [background, setBackground] = useState('skybox');
const [splatQuality, setSplatQuality] = useState('standard');
const [minNodeSize, setMinNodeSize] = useState(30);
const [pointSizeType, setPointSizeType] = useState('adaptive');
const [pointShape, setPointShape] = useState('square');
const [pointColorType, setPointColorType] = useState('rgb');
const [showBoundingBox, setShowBoundingBox] = useState(false);
const [freeze, setFreeze] = useState(false);
const [moveSpeed, setMoveSpeed] = useState(8.4);
const [clipMode, setClipMode] = useState('highlight');
// Refs для слайдеров
const pointBudgetRef = useRef<HTMLInputElement>(null);
const fovRef = useRef<HTMLInputElement>(null);
const edlRadiusRef = useRef<HTMLInputElement>(null);
const edlStrengthRef = useRef<HTMLInputElement>(null);
const edlOpacityRef = useRef<HTMLInputElement>(null);
const minNodeSizeRef = useRef<HTMLInputElement>(null);
const moveSpeedRef = useRef<HTMLInputElement>(null);
const togglePanel = () => {
setIsOpen(!isOpen);
};
const toggleSection = (sectionName: string) => {
setActiveSection(activeSection === sectionName ? null : sectionName);
};
// Синхронизация с viewer
useEffect(() => {
if (!viewer) return;
// Обновляем состояние из viewer
setPointBudget(viewer.getPointBudget?.() || 1000000);
setFov(viewer.getFOV?.() || 60);
setEdlEnabled(viewer.getEDLEnabled?.() || false);
setEdlRadius(viewer.getEDLRadius?.() || 1.4);
setEdlStrength(viewer.getEDLStrength?.() || 0.4);
setEdlOpacity(viewer.getEDLOpacity?.() || 1.0);
setBackground(viewer.getBackground?.() || 'skybox');
setMinNodeSize(viewer.getMinNodeSize?.() || 30);
setMoveSpeed(viewer.getMoveSpeed?.() || 8.4);
// Добавляем слушатели событий
const listeners = [
viewer.addEventListener?.('point_budget_changed', () => setPointBudget(viewer.getPointBudget())),
viewer.addEventListener?.('fov_changed', () => setFov(viewer.getFOV())),
viewer.addEventListener?.('use_edl_changed', () => setEdlEnabled(viewer.getEDLEnabled())),
viewer.addEventListener?.('edl_radius_changed', () => setEdlRadius(viewer.getEDLRadius())),
viewer.addEventListener?.('edl_strength_changed', () => setEdlStrength(viewer.getEDLStrength())),
viewer.addEventListener?.('background_changed', () => setBackground(viewer.getBackground())),
viewer.addEventListener?.('minnodesize_changed', () => setMinNodeSize(viewer.getMinNodeSize())),
viewer.addEventListener?.('move_speed_changed', () => setMoveSpeed(viewer.getMoveSpeed())),
];
return () => {
// Cleanup listeners if needed
};
}, [viewer]);
const handleSliderChange = (type: string, value: number) => {
if (!viewer) return;
switch (type) {
case 'pointBudget':
viewer.setPointBudget?.(value);
setPointBudget(value);
break;
case 'fov':
viewer.setFOV?.(value);
setFov(value);
break;
case 'edlRadius':
viewer.setEDLRadius?.(value);
setEdlRadius(value);
break;
case 'edlStrength':
viewer.setEDLStrength?.(value);
setEdlStrength(value);
break;
case 'edlOpacity':
viewer.setEDLOpacity?.(value);
setEdlOpacity(value);
break;
case 'minNodeSize':
viewer.setMinNodeSize?.(value);
setMinNodeSize(value);
break;
case 'moveSpeed':
viewer.setMoveSpeed?.(value);
setMoveSpeed(value);
break;
// Применяем настройки к viewer
try {
if (viewer.setPointBudget) viewer.setPointBudget(pointBudget);
if (viewer.setFOV) viewer.setFOV(fov);
if (viewer.setEDLEnabled) viewer.setEDLEnabled(edlEnabled);
// Настройки материала точек
if (viewer.scene && viewer.scene.pointclouds) {
viewer.scene.pointclouds.forEach((pointcloud: any) => {
if (pointcloud.material) {
pointcloud.material.size = pointSize;
pointcloud.material.pointSizeType = window.Potree?.PointSizeType?.[pointSizeType.toUpperCase()] || 0;
pointcloud.material.shape = window.Potree?.PointShape?.[pointShape.toUpperCase()] || 0;
pointcloud.material.pointColorType = window.Potree?.PointColorType?.[pointColorType.toUpperCase()] || 0;
}
});
}
} catch (error) {
console.warn('Error applying settings to viewer:', error);
}
};
const handleCheckboxChange = (type: string, checked: boolean) => {
if (!viewer) return;
switch (type) {
case 'edlEnabled':
viewer.setEDLEnabled?.(checked);
setEdlEnabled(checked);
break;
case 'showBoundingBox':
viewer.setShowBoundingBox?.(checked);
setShowBoundingBox(checked);
break;
case 'freeze':
viewer.setFreeze?.(checked);
setFreeze(checked);
break;
}
};
const handleBackgroundChange = (value: string) => {
if (!viewer) return;
viewer.setBackground?.(value);
setBackground(value);
};
const handleSplatQualityChange = (value: string) => {
if (!viewer) return;
viewer.useHQ = value === 'hq';
setSplatQuality(value);
};
const toggleSection = (section: string) => {
setActiveSection(activeSection === section ? '' : section);
};
const formatNumber = (num: number): string => {
return num.toLocaleString();
};
const createToolButton = (icon: string, title: string, onClick: () => void) => (
<button
key={title}
className="tool-button"
title={title}
onClick={onClick}
>
<img src={icon} alt={title} />
</button>
);
}, [viewer, pointSize, pointBudget, fov, edlEnabled, edlRadius, edlStrength, pointSizeType, pointShape, pointColorType]);
const measurementTools = [
{ icon: '/potree/resources/icons/angle.svg', title: 'Измерение угла', action: () => console.log('Angle measurement') },
{ icon: '/potree/resources/icons/point.svg', title: 'Измерение точки', action: () => console.log('Point measurement') },
{ icon: '/potree/resources/icons/distance.svg', title: 'Измерение расстояния', action: () => console.log('Distance measurement') },
{ icon: '/potree/resources/icons/height.svg', title: 'Измерение высоты', action: () => console.log('Height measurement') },
{ icon: '/potree/resources/icons/circle.svg', title: 'Измерение круга', action: () => console.log('Circle measurement') },
{ icon: '/potree/resources/icons/area.svg', title: 'Измерение площади', action: () => console.log('Area measurement') },
{ icon: '/potree/resources/icons/volume.svg', title: 'Измерение объёма', action: () => console.log('Volume measurement') },
{ icon: '/potree/resources/icons/profile.svg', title: 'Профиль высот', action: () => console.log('Height profile') },
{ icon: '/potree/resources/icons/annotation.svg', title: 'Аннотация', action: () => console.log('Annotation') },
{ icon: '/potree/resources/icons/reset_tools.svg', title: 'Удалить все измерения', action: () => console.log('Remove all') },
{
icon: '/potree/resources/icons/distance.svg',
title: 'Расстояние',
action: () => viewer?.scene?.addTool?.(new window.Potree.DistanceTool(viewer.scene))
},
{
icon: '/potree/resources/icons/area.svg',
title: 'Площадь',
action: () => viewer?.scene?.addTool?.(new window.Potree.AreaTool(viewer.scene))
},
{
icon: '/potree/resources/icons/angle.svg',
title: 'Угол',
action: () => viewer?.scene?.addTool?.(new window.Potree.AngleTool(viewer.scene))
},
{
icon: '/potree/resources/icons/point.svg',
title: 'Точка',
action: () => viewer?.scene?.addTool?.(new window.Potree.PointTool(viewer.scene))
},
{
icon: '/potree/resources/icons/height.svg',
title: 'Высота',
action: () => viewer?.scene?.addTool?.(new window.Potree.HeightTool(viewer.scene))
},
{
icon: '/potree/resources/icons/circle.svg',
title: 'Круг',
action: () => viewer?.scene?.addTool?.(new window.Potree.CircleTool(viewer.scene))
}
];
const clippingTools = [
{ icon: '/potree/resources/icons/clip_volume.svg', title: 'Объём обрезки', action: () => console.log('Clip volume') },
{ icon: '/potree/resources/icons/clip-polygon.svg', title: 'Полигон обрезки', action: () => console.log('Clip polygon') },
{ icon: '/potree/resources/icons/clip-screen.svg', title: 'Экранная обрезка', action: () => console.log('Screen clip') },
{ icon: '/potree/resources/icons/remove.svg', title: 'Удалить обрезку', action: () => console.log('Remove clipping') },
{
icon: '/potree/resources/icons/clip-polygon.svg',
title: 'Полигон',
action: () => viewer?.scene?.addTool?.(new window.Potree.PolygonClipTool(viewer.scene))
},
{
icon: '/potree/resources/icons/clip-screen.svg',
title: 'Экран',
action: () => viewer?.scene?.addTool?.(new window.Potree.ScreenClipTool(viewer.scene))
},
{
icon: '/potree/resources/icons/clip_volume.svg',
title: 'Объём',
action: () => viewer?.scene?.addTool?.(new window.Potree.BoxSelectTool(viewer.scene))
}
];
return (
<div className="potree-sidebar-react">
<div className="sidebar-header">
<span className="sidebar-brand">
<a href="https://cybercode.pro/" target="_blank" rel="noopener noreferrer">
КиберКод
</a>
</span>
<span className="sidebar-version">1.8.0</span>
</div>
<div className="sidebar-panel">
{/* Кнопка-триггер */}
<button
className={`sidebar-trigger ${isOpen ? 'active' : ''}`}
onClick={togglePanel}
title="Настройки"
>
<img
src="/potree/resources/icons/menu_icon.svg"
alt="Настройки"
style={{ width: '24px', height: '24px', filter: 'brightness(0) invert(1)' }}
/>
</button>
<div className="sidebar-content">
{/* ВНЕШНИЙ ВИД */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'appearance' ? 'active' : ''}`}
onClick={() => toggleSection('appearance')}
>
Внешний вид
</h3>
{activeSection === 'appearance' && (
<div className="section-content">
<div className="control-group">
<label>Лимит точек: <span className="value">{formatNumber(pointBudget)}</span></label>
<input
ref={pointBudgetRef}
type="range"
min="100000"
max="10000000"
step="1000"
value={pointBudget}
onChange={(e) => handleSliderChange('pointBudget', parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label>Поле зрения: <span className="value">{fov}</span></label>
<input
ref={fovRef}
type="range"
min="20"
max="100"
step="1"
value={fov}
onChange={(e) => handleSliderChange('fov', parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Обводка по глубине (EDL)</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={edlEnabled}
onChange={(e) => handleCheckboxChange('edlEnabled', e.target.checked)}
/>
Включить EDL
</label>
</div>
<div className="control-group">
<label>Радиус EDL: <span className="value">{edlRadius.toFixed(1)}</span></label>
<input
ref={edlRadiusRef}
type="range"
min="1"
max="4"
step="0.01"
value={edlRadius}
onChange={(e) => handleSliderChange('edlRadius', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label>Сила EDL: <span className="value">{edlStrength.toFixed(1)}</span></label>
<input
ref={edlStrengthRef}
type="range"
min="0"
max="5"
step="0.01"
value={edlStrength}
onChange={(e) => handleSliderChange('edlStrength', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label>Непрозрачность EDL: <span className="value">{edlOpacity.toFixed(1)}</span></label>
<input
ref={edlOpacityRef}
type="range"
min="0"
max="1"
step="0.01"
value={edlOpacity}
onChange={(e) => handleSliderChange('edlOpacity', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Фон</div>
<div className="control-group">
<div className="radio-group">
{['skybox', 'gradient', 'black', 'white', 'null'].map((bg) => (
<label key={bg} className="radio-label">
{/* Попап с настройками */}
{isOpen && (
<>
{/* Оверлей для закрытия при клике вне панели */}
<div className="sidebar-overlay" onClick={() => setIsOpen(false)} />
{/* Панель с настройками */}
<div className="sidebar-popup">
<div className="sidebar-popup-header">
<h3>Настройки</h3>
<button
className="sidebar-close"
onClick={() => setIsOpen(false)}
title="Закрыть"
>
×
</button>
</div>
<div className="sidebar-popup-content">
{/* Секция "Внешний вид" */}
<div className="sidebar-section">
<button
className={`section-header ${activeSection === 'appearance' ? 'active' : ''}`}
onClick={() => toggleSection('appearance')}
>
Внешний вид
<span className="section-arrow">{activeSection === 'appearance' ? '▼' : '▶'}</span>
</button>
{activeSection === 'appearance' && (
<div className="section-content">
<div className="control-group">
<label>
Размер точек: <span className="value">{pointSize.toFixed(1)}</span>
</label>
<input
type="radio"
name="background"
value={bg}
checked={background === bg}
onChange={(e) => handleBackgroundChange(e.target.value)}
type="range"
min="0.1"
max="5"
step="0.1"
value={pointSize}
onChange={(e) => setPointSize(parseFloat(e.target.value))}
className="slider"
/>
{bg === 'skybox' ? 'Небо' :
bg === 'gradient' ? 'Градиент' :
bg === 'black' ? 'Чёрный' :
bg === 'white' ? 'Белый' : 'Без фона'}
</div>
<div className="control-group">
<label>
Бюджет точек: <span className="value">{(pointBudget / 1000000).toFixed(1)}M</span>
</label>
<input
type="range"
min="100000"
max="10000000"
step="100000"
value={pointBudget}
onChange={(e) => setPointBudget(parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label>
Поле зрения: <span className="value">{fov}°</span>
</label>
<input
type="range"
min="20"
max="120"
step="1"
value={fov}
onChange={(e) => setFov(parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Тип размера точек</div>
<div className="radio-group">
<label className="radio-label">
<input
type="radio"
name="pointSizeType"
value="fixed"
checked={pointSizeType === 'fixed'}
onChange={(e) => setPointSizeType(e.target.value)}
/>
Фиксированный
</label>
<label className="radio-label">
<input
type="radio"
name="pointSizeType"
value="adaptive"
checked={pointSizeType === 'adaptive'}
onChange={(e) => setPointSizeType(e.target.value)}
/>
Адаптивный
</label>
</div>
<div className="divider">Форма точек</div>
<div className="radio-group">
<label className="radio-label">
<input
type="radio"
name="pointShape"
value="square"
checked={pointShape === 'square'}
onChange={(e) => setPointShape(e.target.value)}
/>
Квадрат
</label>
<label className="radio-label">
<input
type="radio"
name="pointShape"
value="circle"
checked={pointShape === 'circle'}
onChange={(e) => setPointShape(e.target.value)}
/>
Круг
</label>
</div>
<div className="divider">Цветовая схема</div>
<div className="radio-group">
<label className="radio-label">
<input
type="radio"
name="pointColorType"
value="rgb"
checked={pointColorType === 'rgb'}
onChange={(e) => setPointColorType(e.target.value)}
/>
RGB
</label>
<label className="radio-label">
<input
type="radio"
name="pointColorType"
value="elevation"
checked={pointColorType === 'elevation'}
onChange={(e) => setPointColorType(e.target.value)}
/>
Высота
</label>
<label className="radio-label">
<input
type="radio"
name="pointColorType"
value="intensity"
checked={pointColorType === 'intensity'}
onChange={(e) => setPointColorType(e.target.value)}
/>
Интенсивность
</label>
</div>
</div>
)}
</div>
{/* Секция "Инструменты" */}
<div className="sidebar-section">
<button
className={`section-header ${activeSection === 'tools' ? 'active' : ''}`}
onClick={() => toggleSection('tools')}
>
Инструменты измерения
<span className="section-arrow">{activeSection === 'tools' ? '▼' : '▶'}</span>
</button>
{activeSection === 'tools' && (
<div className="section-content">
<div className="tools-grid">
{measurementTools.map((tool, index) => (
<button
key={index}
className="tool-button"
title={tool.title}
onClick={tool.action}
>
<img src={tool.icon} alt={tool.title} />
</button>
))}
</div>
</div>
)}
</div>
{/* Секция "Обрезка" */}
<div className="sidebar-section">
<button
className={`section-header ${activeSection === 'clipping' ? 'active' : ''}`}
onClick={() => toggleSection('clipping')}
>
Инструменты обрезки
<span className="section-arrow">{activeSection === 'clipping' ? '▼' : '▶'}</span>
</button>
{activeSection === 'clipping' && (
<div className="section-content">
<div className="tools-grid">
{clippingTools.map((tool, index) => (
<button
key={index}
className="tool-button"
title={tool.title}
onClick={tool.action}
>
<img src={tool.icon} alt={tool.title} />
</button>
))}
</div>
</div>
)}
</div>
{/* Секция "Фильтры" */}
<div className="sidebar-section">
<button
className={`section-header ${activeSection === 'filters' ? 'active' : ''}`}
onClick={() => toggleSection('filters')}
>
Фильтры и эффекты
<span className="section-arrow">{activeSection === 'filters' ? '▼' : '▶'}</span>
</button>
{activeSection === 'filters' && (
<div className="section-content">
<div className="divider">Обводка по глубине (EDL)</div>
<label className="checkbox-label">
<input
type="checkbox"
checked={edlEnabled}
onChange={(e) => setEdlEnabled(e.target.checked)}
/>
Включить EDL
</label>
))}
</div>
</div>
<div className="divider">Прочее</div>
{edlEnabled && (
<>
<div className="control-group">
<label>
Радиус EDL: <span className="value">{edlRadius.toFixed(1)}</span>
</label>
<input
type="range"
min="0.1"
max="5"
step="0.1"
value={edlRadius}
onChange={(e) => setEdlRadius(parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<div className="radio-group">
<label className="radio-label">
<input
type="radio"
name="splatQuality"
value="standard"
checked={splatQuality === 'standard'}
onChange={(e) => handleSplatQualityChange(e.target.value)}
/>
Стандартное качество
</label>
<label className="radio-label">
<input
type="radio"
name="splatQuality"
value="hq"
checked={splatQuality === 'hq'}
onChange={(e) => handleSplatQualityChange(e.target.value)}
/>
Высокое качество
</label>
</div>
</div>
<div className="control-group">
<label>
Сила EDL: <span className="value">{edlStrength.toFixed(1)}</span>
</label>
<input
type="range"
min="0.1"
max="2"
step="0.1"
value={edlStrength}
onChange={(e) => setEdlStrength(parseFloat(e.target.value))}
className="slider"
/>
</div>
</>
)}
<div className="control-group">
<label>Минимальный размер узла: <span className="value">{minNodeSize}</span></label>
<input
ref={minNodeSizeRef}
type="range"
min="0"
max="1000"
step="1"
value={minNodeSize}
onChange={(e) => handleSliderChange('minNodeSize', parseInt(e.target.value))}
className="slider"
/>
</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={showBoundingBox}
onChange={(e) => handleCheckboxChange('showBoundingBox', e.target.checked)}
/>
Показать границы
</label>
</div>
<div className="control-group">
<label className="checkbox-label">
<input
type="checkbox"
checked={freeze}
onChange={(e) => handleCheckboxChange('freeze', e.target.checked)}
/>
Заблокировать вид
</label>
</div>
</div>
)}
</div>
{/* ИНСТРУМЕНТЫ */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'tools' ? 'active' : ''}`}
onClick={() => toggleSection('tools')}
>
Инструменты
</h3>
{activeSection === 'tools' && (
<div className="section-content">
<div className="divider">Измерение</div>
<div className="tools-grid">
{measurementTools.map((tool) =>
createToolButton(tool.icon, tool.title, tool.action)
<div className="divider">Отображение</div>
<label className="checkbox-label">
<input
type="checkbox"
checked={showBoundingBox}
onChange={(e) => setShowBoundingBox(e.target.checked)}
/>
Показать границы
</label>
</div>
)}
</div>
<div className="divider">Обрезка</div>
<div className="tools-grid">
{clippingTools.map((tool) =>
createToolButton(tool.icon, tool.title, tool.action)
)}
</div>
<div className="control-group">
<label>Скорость движения: <span className="value">{moveSpeed.toFixed(1)}</span></label>
<input
ref={moveSpeedRef}
type="range"
min="1"
max="1000"
step="0.1"
value={moveSpeed}
onChange={(e) => handleSliderChange('moveSpeed', parseFloat(e.target.value))}
className="slider"
/>
</div>
<div className="divider">Примечание</div>
<p style={{ fontSize: '12px', color: 'rgba(255, 255, 255, 0.7)', margin: 0 }}>
Инструменты навигации перенесены в отдельную панель справа →
</p>
</div>
)}
</div>
{/* СЦЕНА */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'scene' ? 'active' : ''}`}
onClick={() => toggleSection('scene')}
>
Сцена
</h3>
{activeSection === 'scene' && (
<div className="section-content">
<div className="divider">Экспорт</div>
<div className="export-buttons">
<button className="export-btn" title="Экспорт GeoJSON">
<img src="/potree/resources/icons/file_geojson.svg" alt="GeoJSON" />
</button>
<button className="export-btn" title="Экспорт DXF">
<img src="/potree/resources/icons/file_dxf.svg" alt="DXF" />
</button>
<button className="export-btn" title="Экспорт Potree">
<img src="/potree/resources/icons/file_potree.svg" alt="Potree" />
</button>
</div>
<div className="divider">Объекты</div>
<div className="scene-tree">
{/* Здесь будет дерево объектов сцены */}
<div className="tree-item">Point Clouds</div>
<div className="tree-item">Measurements</div>
<div className="tree-item">Annotations</div>
<div className="tree-item">Other</div>
</div>
</div>
)}
</div>
{/* ФИЛЬТРЫ */}
<div className="sidebar-section">
<h3
className={`section-header ${activeSection === 'filters' ? 'active' : ''}`}
onClick={() => toggleSection('filters')}
>
Фильтры
</h3>
{activeSection === 'filters' && (
<div className="section-content">
<div className="divider">Классификация</div>
<div className="classification-list">
{/* Здесь будут элементы классификации */}
<label className="checkbox-label">
<input type="checkbox" defaultChecked />
Показать/скрыть всё
</label>
</div>
</div>
)}
</div>
</div>
</div>
</>
)}
</div>
);
};

View File

@ -13,7 +13,6 @@ const PotreeViewer: React.FC = () => {
const [isLoading, setIsLoading] = useState(true);
const [loadingMessage, setLoadingMessage] = useState('Инициализация...');
const [error, setError] = useState<string | null>(null);
const [sidebarVisible, setSidebarVisible] = useState(false);
const [viewer, setViewer] = useState<any>(null);
// Функция для принудительного применения стилей к слайдерам
@ -630,11 +629,6 @@ const PotreeViewer: React.FC = () => {
navigate('/login');
};
const toggleSidebar = () => {
setSidebarVisible(!sidebarVisible);
console.log('Sidebar toggled:', !sidebarVisible);
};
if (error) {
return (
<div className="potree-error">
@ -681,15 +675,8 @@ const PotreeViewer: React.FC = () => {
</button>
</div>
{/* Кнопка управления сайдбаром */}
<div className={`potree-sidebar-toggle ${!sidebarVisible ? 'sidebar-hidden' : ''}`}>
<button
onClick={toggleSidebar}
className="potree-button primary"
>
{sidebarVisible ? '←' : '→'}
</button>
</div>
{/* Панель настроек */}
<PotreeSidebar viewer={viewer} />
{/* Навигационная панель */}
<NavigationPanel viewer={viewer} />
@ -700,25 +687,6 @@ const PotreeViewer: React.FC = () => {
id="potree_render_area"
ref={renderAreaRef}
/>
{/* React Сайдбар */}
{sidebarVisible && (
<div
id="potree_sidebar_container"
className="potree-sidebar"
style={{
position: 'absolute',
top: 0,
left: 0,
width: '300px',
height: '100%',
zIndex: 1000,
transition: 'transform 0.3s ease'
}}
>
<PotreeSidebar viewer={viewer} />
</div>
)}
</div>
</div>
);