Smart Site
Home Docs Smart SCADA Configuration Guide

Configuration Guide

This guide explains the various configuration options of Smart SCADA Editor, covering environment variables, canvas config, editor settings, theme config and shortcuts.

Config loading priority: Environment variables > Database config > Editor settings > Default values.

1. Environment Variables (.env)

1.1 Frontend Environment Files

Frontend environment files are located at ss-editor/apps/web/:

File Scenario Load Condition
.env.development Local development vite dev (default)
.env.production Production build vite build
.env.example Config template Not loaded, reference only

1.2 Frontend Core Environment Variables

Variable Default Description
VITE_API_BASE_URL http://localhost:4000 Backend API address
VITE_WS_URL http://localhost:4000 WebSocket address
VITE_DEBUG_SKIP_AUTH false Skip frontend route guard token check (dev only)

1.3 Backend Environment Variables (Affecting Editor Data)

Backend environment variables are located in ss-services\ss-data. Key variables affecting editor data binding:

Variable Description
PORT Backend service port (default 4000), must match frontend VITE_API_BASE_URL
PROJECTS_DIR Project data directory, where screen data is stored
PROJECT_DB_MODE Project DB mode: isolated / unified

⚠️ After changing backend PORT, you must also update frontend VITE_API_BASE_URL and VITE_WS_URL.

2. Canvas Configuration

2.1 Canvas Global Settings

Configure canvas global parameters in editor Settings → Canvas:

Config Default Description
Canvas Width 1920 Default canvas width (pixels)
Canvas Height 1080 Default canvas height (pixels)
Background var(--surface) Canvas background color (CSS variable)
Grid Size 10 Grid spacing (pixels)
Grid Visible true Whether to show grid
Ruler Visible true Whether to show rulers
Snap Alignment true Whether to enable snap alignment
Snap Threshold 5 Snap alignment threshold (pixels)

2.2 Per-Screen Configuration

Each screen can be configured individually:

Config Description
Screen Name Display name
Screen Code Unique identifier, for routing and API
Screen Size Custom width/height
Background Screen background color
Thumbnail Auto-generated or custom

2.3 Canvas Operation Configuration

Operation Config Default
Zoom sensitivity Wheel zoom step 0.1
Min zoom Canvas min zoom ratio 0.1
Max zoom Canvas max zoom ratio 5.0
Pan method Space+drag / middle-click drag Both enabled

3. Editor Settings

3.1 Interface Settings

Configure in editor Settings → Interface:

Config Default Description
Theme dark Theme mode (light / dark / auto)
Language zh-CN Interface language (zh-CN / en-US)
Sidebar Position left Shape library sidebar position
Property Panel Position right Property panel position
Toolbar Position top Toolbar position

3.2 Tool Settings

Configure in editor Settings → Tools:

Config Default Description
Auto Save true Whether to enable auto save
Auto Save Interval 30 Auto save interval (seconds)
Undo Steps 50 Max history steps
Preserve ID on Copy false Whether copied shapes preserve original ID

3.3 Layout Settings

Configure panel layout in editor Settings → Layout:

Panel Default Width Hideable
Shape Library 280px ✅
Property Panel 320px ✅
Layer Panel 240px ✅
Toolbar 48px ✅
Page Tabs 36px ✅

4. Theme Configuration

4.1 Built-in Themes

The editor includes the following themes:

Theme Description Use Case
dark Dark theme (default) Long editing sessions, low-light environments
light Light theme High-light environments, documentation screenshots
auto Follow system Auto-switch

4.2 CSS Variables

Themes are implemented via CSS variables. Key variables:

Variable Purpose Example (dark)
--primary Primary color #3b82f6
--surface Surface background #1e293b
--surface-2 Secondary surface #0f172a
--text Primary text color #e2e8f0
--text-secondary Secondary text #94a3b8
--border Border color #334155
--success Success color #22c55e
--warning Warning color #f59e0b
--danger Danger color #ef4444

⚠️ Mandatory rule: All colors must use CSS variables. Hardcoded color values are strictly prohibited.

4.3 Custom Theme

Define custom themes in plugin-sdk/themes/all-themes.css:

[data-theme="custom"] {
  --primary: #your-color;
  --surface: #your-color;
  --text: #your-color;
  --border: #your-color;
  /* ... */
}

5. Shortcut Configuration

5.1 Default Shortcuts

Operation Shortcut Description
Undo Ctrl + Z Undo last action
Redo Ctrl + Y / Ctrl + Shift + Z Redo
Copy Ctrl + C Copy selected shapes
Paste Ctrl + V Paste shapes
Cut Ctrl + X Cut shapes
Delete Delete / Backspace Delete selected shapes
Select All Ctrl + A Select all shapes
Deselect Esc Cancel selection
Group Ctrl + G Group selected shapes
Ungroup Ctrl + Shift + G Ungroup
Zoom In Ctrl + = / Ctrl + + Zoom in canvas
Zoom Out Ctrl + - Zoom out canvas
Reset Zoom Ctrl + 0 Reset canvas zoom to 100%
Fit Screen Ctrl + Shift + F Fit canvas to screen
Save Ctrl + S Save screen
Preview F5 Enter runtime preview
Align Left Ctrl + Shift + L Left align
Align Center Ctrl + Shift + C Horizontal center align
Align Right Ctrl + Shift + R Right align
Align Top Ctrl + Shift + T Top align
Align Bottom Ctrl + Shift + B Bottom align
Distribute Ctrl + Shift + D Horizontal equal distribution

5.2 Custom Shortcuts

View and modify shortcut bindings in editor Settings → Shortcuts.

6. Runtime Configuration

6.1 Runtime Parameters

Config Default Description
Data Refresh Interval 1000 Real-time data refresh interval (ms)
Script Execution Timeout 5000 Script execution timeout (ms)
WebSocket Reconnect Interval 3000 WebSocket reconnection interval (ms)
Debug Mode false Whether to enable debug panel

6.2 Debug Panel

In runtime mode, enable debug panel to view:

  • Runtime Data: Real-time data values bound to shapes
  • Performance: Render frame rate, memory usage
  • Script Logs: Console output from script execution
  • Event Tracking: User interaction event records

7. Internationalization Configuration

7.1 Supported Languages

Language Code File Location
Simplified Chinese zh-CN packages/core/src/locales/zh-CN.json
English en-US packages/core/src/locales/en-US.json

7.2 Switch Language

  • Switch in editor Settings → Interface → Language
  • Or modify the language field in user config

💡 New UI text must use $t('xxx.yyy') and sync translations in both language files.