-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.html
More file actions
256 lines (240 loc) · 11.5 KB
/
editor.html
File metadata and controls
256 lines (240 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZDFShot - 图片编辑</title>
<link rel="stylesheet" href="editor.css">
<script src="i18n.js"></script>
</head>
<body>
<div class="app">
<!-- 顶部工具栏 -->
<header class="topbar">
<div class="brand">
<div class="logo-icon">
<img src="icons/icon32.png" alt="ZDFShot" />
</div>
<span class="logo-text">ZDFShot</span>
</div>
<nav class="tools">
<div class="tool-group">
<button class="tool active" data-tool="select" data-i18n-title="titleSelect">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/>
</svg>
</button>
<button class="tool" data-tool="rect" data-i18n-title="titleRect">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<rect x="4" y="6" width="16" height="12" rx="1"/>
</svg>
</button>
<button class="tool" data-tool="roundRect" data-i18n-title="titleRoundRect">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<rect x="4" y="6" width="16" height="12" rx="3"/>
</svg>
</button>
<button class="tool" data-tool="ellipse" data-i18n-title="titleEllipse">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<circle cx="12" cy="12" r="7"/>
</svg>
</button>
<button class="tool" data-tool="arrow" data-i18n-title="titleArrow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M5 12h12M14 7l5 5-5 5"/>
</svg>
</button>
<button class="tool" data-tool="line" data-i18n-title="titleLine">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M5 19L19 5"/>
</svg>
</button>
<button class="tool" data-tool="pen" data-i18n-title="titlePen">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M12 19l7-7 3 3-7 7-3-3z"/>
<path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/>
</svg>
</button>
<button class="tool" data-tool="triangle" data-i18n-title="titleTriangle">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M12 4L4 20h16L12 4z"/>
</svg>
</button>
<button class="tool" data-tool="star" data-i18n-title="titleStar">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
</svg>
</button>
<button class="tool" data-tool="text" data-i18n-title="titleText">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M4 7V4h16v3M9 20h6M12 4v16"/>
</svg>
</button>
</div>
<div class="divider"></div>
<div class="tool-group">
<button class="tool" data-tool="mosaic" data-i18n-title="titleMosaic">
<!-- 马赛克:3×3 像素格,深浅交错体现像素化 -->
<svg viewBox="0 0 24 24" fill="currentColor" stroke="none">
<rect x="2" y="2" width="6" height="6" opacity=".9"/>
<rect x="10" y="2" width="6" height="6" opacity=".4"/>
<rect x="18" y="2" width="4" height="6" opacity=".9"/>
<rect x="2" y="10" width="6" height="6" opacity=".4"/>
<rect x="10" y="10" width="6" height="6" opacity=".9"/>
<rect x="18" y="10" width="4" height="6" opacity=".4"/>
<rect x="2" y="18" width="6" height="4" opacity=".9"/>
<rect x="10" y="18" width="6" height="4" opacity=".4"/>
<rect x="18" y="18" width="4" height="4" opacity=".9"/>
</svg>
</button>
<button class="tool" data-tool="blur" data-i18n-title="titleBlur">
<!-- 模糊:三组波浪线,视觉上表达扩散/模糊感 -->
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round">
<path d="M2 7c2.5-2.5 5-2.5 7.5 0S15 9.5 17.5 7 20 4.5 22 7"/>
<path d="M2 12c2.5-2.5 5-2.5 7.5 0S15 14.5 17.5 12 20 9.5 22 12"/>
<path d="M2 17c2.5-2.5 5-2.5 7.5 0S15 19.5 17.5 17 20 14.5 22 17"/>
</svg>
</button>
</div>
</nav>
<div class="styles">
<button class="style-btn" id="fillToggle" data-i18n-title="strokeMode">
<svg class="stroke-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<rect x="5" y="5" width="14" height="14" rx="1"/>
</svg>
<svg class="fill-icon" viewBox="0 0 24 24" fill="currentColor" style="display:none">
<rect x="5" y="5" width="14" height="14" rx="1"/>
</svg>
</button>
<div class="color-wrap">
<input type="color" id="colorPicker" value="#ff4444">
<div class="color-dots">
<span class="dot active" style="background:#ff4444" data-color="#ff4444"></span>
<span class="dot" style="background:#ff6b35" data-color="#ff6b35"></span>
<span class="dot" style="background:#ffd93d" data-color="#ffd93d"></span>
<span class="dot" style="background:#6bcf7f" data-color="#6bcf7f"></span>
<span class="dot" style="background:#4d96ff" data-color="#4d96ff"></span>
<span class="dot" style="background:#9b59b6" data-color="#9b59b6"></span>
<span class="dot" style="background:#2c3e50" data-color="#2c3e50"></span>
</div>
</div>
<div class="width-slider">
<input type="range" id="strokeWidth" min="1" max="72" value="20">
<span class="width-value">20</span>
</div>
<div class="font-wrap">
<select id="fontFamily" title="字体">
<option value="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', Roboto, sans-serif">系统默认</option>
<option value="'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif">思源黑体</option>
<option value="'PingFang SC', 'Microsoft YaHei', sans-serif">苹方/雅黑</option>
<option value="Georgia, 'Times New Roman', serif">Serif</option>
<option value="'Courier New', Consolas, monospace">Monospace</option>
</select>
</div>
</div>
<div class="actions">
<button class="lang-btn" id="langToggle" title="Switch Language / 切换语言">
<span id="langLabel">中/En</span>
</button>
<button class="icon-btn" id="undoBtn" data-i18n-title="undoTitle">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M9 14L4 9l5-5"/>
<path d="M4 9h10a6 6 0 0 1 6 6v0"/>
</svg>
</button>
<button class="icon-btn" id="redoBtn" data-i18n-title="redoTitle">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M15 14l5-5-5-5"/>
<path d="M20 9H10a6 6 0 0 0-6 6v0"/>
</svg>
</button>
<button class="icon-btn" id="deleteBtn" data-i18n-title="deleteTitle" disabled>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14"/>
</svg>
</button>
<div class="divider"></div>
<button class="btn btn-ghost" id="cropBtn" title="裁剪图片">
<!-- 裁剪标准图标:两个 L 形把手 -->
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" style="vertical-align:-2px;margin-right:4px">
<path d="M5 3v15a1 1 0 0 0 1 1h15"/>
<path d="M3 5h15a1 1 0 0 1 1 1v15"/>
</svg>裁剪
</button>
<button class="btn btn-ghost" id="clearBtn" data-i18n="clear"></button>
<button class="btn btn-ghost" id="copyBtn" data-i18n="copy"></button>
<button class="btn btn-primary" id="downloadBtn" data-i18n="save"></button>
</div>
</header>
<!-- 主编辑区 -->
<main class="workspace">
<div class="canvas-wrap">
<div class="crop-overlay" id="cropOverlay">
<div class="crop-hint" data-i18n="cropHint"></div>
<div class="crop-selection"></div>
<div class="crop-live-size" id="cropLiveSize">0 × 0</div>
<div class="crop-actions">
<button class="btn btn-ghost" id="cropCancel" data-i18n="cancel"></button>
<button class="btn btn-primary" id="cropConfirm" data-i18n="cropConfirm"></button>
</div>
</div>
<!-- 画布视口:支持缩放和平移 -->
<div class="canvas-viewport" id="canvasViewport">
<div class="canvas-transform" id="canvasTransform">
<canvas id="editorCanvas"></canvas>
</div>
</div>
</div>
<!-- 图层面板 -->
<aside class="layers-panel" id="layersPanel">
<div class="layers-header">
<span data-i18n="layers"></span>
<span class="layer-count" id="layerCount">0</span>
</div>
<div class="layers-list" id="layersList">
<div class="layers-empty" data-i18n="layerEmpty"></div>
</div>
</aside>
</main>
<!-- 文字输入浮层 - 移到body级别使用fixed定位 -->
<div class="text-float" id="textInputLayer">
<div class="text-drag-handle" id="textDragHandle">✥ 文本编辑</div>
<textarea id="textInput" data-i18n-placeholder="textPlaceholder" rows="3"></textarea>
<div class="text-btns">
<button id="textConfirm">✓</button>
<button id="textCancel">✕</button>
</div>
</div>
<!-- 底部状态栏 -->
<footer class="statusbar">
<div class="info">
<span id="canvasSize">0 × 0</span>
<span class="sep">|</span>
<span id="mousePos">0, 0</span>
</div>
<div class="shortcuts">
<span id="shortcutHint" data-i18n="shortcuts"></span>
<div class="zoom-controls zoom-controls-inline">
<button class="zoom-btn" id="zoomOut" title="缩小">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M5 12h14"/>
</svg>
</button>
<span class="zoom-value" id="zoomValue">100%</span>
<button class="zoom-btn" id="zoomIn" title="放大">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 5v14M5 12h14"/>
</svg>
</button>
<button class="zoom-btn" id="zoomFit" title="适应窗口">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
</svg>
</button>
</div>
</div>
</footer>
</div>
<script src="editor.js"></script>
</body>
</html>