feat(image-tools): 文字旋转 + 14 款花字模板(点击即套用)

- 画布直旋:选中文字拖顶部蓝点手柄实时旋转(composite 逐帧重绘),
  松手进历史「旋转文字 N°」;Shift 吸附 15°;旋转锚点=文字框中心,
  命中检测逆旋转(斜着也能点中);属性面板旋转滑条(-180~180)+
  数字输入+一键回正
- 14 款花字模板(B站封面风:描边/底色块/渐变/投影/空心/荧光):
  右侧面板 CSS 小样实时预览,点击即套——未选文字层→插入画布并应用,
  已选中→原地换样式(保留内容/字号/位置/旋转),历史可撤销
- drawTextLayer 渲染管线:色块底(圆角)→投影→描边(×2居中)→渐变/纯色
  填充,全部绕中心旋转;文字层新增 rot/grad/stroke/shadow/badge 字段,
  旧历史数据 rot 缺省自动补 0
- 修复侧栏超高不可滚(模板库+属性+历史区块 overflow-y:auto)
- 实测:模板点击插入(历史「套用模板」)、滑条30°、手柄拖动
  30→72.4→92.1→100.7°实时、原地换模板不建新层且保留旋转角、
  导出金渐变826px/旧红底0、侧栏滚215px后旋转行可见
This commit is contained in:
personal82555 committed 2026-10-21 22:49:17 +08:00
1 parent d9d306956d
commit 263d52475f
6 files changed
+346 -18

No files matched your search

+8
View File
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. See [standa
## Version 2026.10.16-it-tools-pro
### ✨ 文字旋转 + 14 款花字模板(点击即套用)
- **画布直旋**:选中文字后拖顶部蓝色圆点手柄实时旋转(拖动即所见),松手进历史(「旋转文字 N°」);按住 Shift 吸附 15°;旋转以文字框中心为锚点,命中检测同步旋转(斜着也能点中)
- **旋转滑条**:属性面板「旋转」-180°~180° 精调 + 数字输入 + 一键回正
- **14 款花字模板**(B站封面风格):白/黄/青字描边、红/蓝/黑/粉底白字、鎏金/烈焰渐变、白字投影、空心描边、荧光绿——右侧面板点击即套:未选文字层则插入画布并应用,已选中则原地换样式(保留内容/字号/位置/旋转),随后可继续改字/调号/拖动/旋转
- 模板带 CSS 实时小样预览;渲染管线支持:色块底→投影→描边→渐变/纯色填充
- 修复:侧栏内容超高时可滚动(模板库+属性+历史不再互相挤出可视区)
- 文字层新增 rot/grad/stroke/shadow/badge 字段,旧历史数据自动兼容
### ✨ 消除实时预览 + 智能消除笔(橡皮升级)
- **实时预览**:点 OCR 文字框或选框松手的**瞬间**,画布立即显示消除后的效果(蓝标「👁 实时预览已生成」+「预览(未应用)」角标),满意点「✓ 应用消除」落图层,不满意「✕ 取消预览」还原——先看效果再确认,不再是盲操作
- **智能消除笔(橡皮 E 升级)**:直接在底图的文字/水印上涂抹(红色半透明笔迹实时跟随),**松手立即无痕消除**,无需框选、无需 OCR、无需点按钮;选中画笔层时仍是传统擦除
+1 -1
View File
@@ -310,7 +310,7 @@ tools:
image-tools:
title: Image tools
description: "In-browser image toolbox: compress, convert, resize, crop, rotate, filters, mosaic/redaction, Photoshop-style editor (layers, brush, text, selection, OCR text replacement, content-aware erase with live preview), EXIF viewer, QR generate/scan, watermark and stitching. Images never leave your device."
description: "In-browser image toolbox: compress, convert, resize, crop, rotate, filters, mosaic/redaction, Photoshop-style editor (layers, brush, text, selection, OCR text replacement, 14 artistic text templates with canvas rotation, content-aware erase with live preview), EXIF viewer, QR generate/scan, watermark and stitching. Images never leave your device."
pdf-tools:
title: PDF tools
+1 -1
View File
@@ -307,7 +307,7 @@ tools:
image-tools:
title: 图片工具
description: 浏览器本地处理的图片工具箱:图片压缩、格式转换、调整尺寸、裁剪、旋转、滤镜、打码、PS 风格图片编辑(图层/画笔/文字/选区/OCR 改字/智能消除笔实时预览无痕去文字水印)、EXIF 查看、二维码生成/识别、加水印、多图拼接,图片全程不上传。
description: 浏览器本地处理的图片工具箱:图片压缩、格式转换、调整尺寸、裁剪、旋转、滤镜、打码、PS 风格图片编辑(图层/画笔/文字/选区/OCR 改字/14款花字模板+画布旋转/智能消除笔实时预览无痕去文字水印)、EXIF 查看、二维码生成/识别、加水印、多图拼接,图片全程不上传。
pdf-tools:
title: PDF工具
+1 -1
View File
@@ -53,7 +53,7 @@ const groups: { title: string; items: Item[] }[] = [
{ name: '多图拼接', icon: '拼', desc: '横向/纵向长图/九宫格/瀑布流/交错双列/拍立得 6 种方式,网格类 2-4 列可调,间距可调', tag: '改造' },
{ name: 'JSON 美化和格式化', icon: 'J', desc: '双栏专业工作台:左侧行号编辑,右侧树视图/语法高亮切换,含 Dict/Get参数/XML/CSV 等 7 种转换', tag: '改造' },
{ name: 'PDF工具', icon: 'P', desc: '合并/拆分/旋转/重排/压缩/加密/解密/水印/提取文本/页码/转图片,11 功能全程浏览器本地处理,需授权使用', tag: '授权' },
{ name: '图片工具', icon: '图', desc: '压缩/转换/尺寸/裁剪/旋转/滤镜/打码/PS 风格编辑器(图层+画笔+文字+选区+历史记录+OCR 改字/智能消除/消除笔实时预览无痕去文字水印)/EXIF/二维码生成识别/水印/拼接,13 功能本地处理,需授权使用', tag: '授权' },
{ name: '图片工具', icon: '图', desc: '压缩/转换/尺寸/裁剪/旋转/滤镜/打码/PS 风格编辑器(图层+画笔+文字+选区+历史记录+OCR 改字/文字模板+画布旋转、智能消除笔实时预览无痕去文字水印)/EXIF/二维码生成识别/水印/拼接,13 功能本地处理,需授权使用', tag: '授权' },
],
},
{
+334 -14
View File
@@ -16,7 +16,37 @@ let compCanvas: HTMLCanvasElement | null = null; // 合成缓存(doc 分辨率
interface TextLayer {
id: string; type: 'text'; name: string; visible: boolean; opacity: number;
text: string; x: number; y: number; size: number; color: string; bold: boolean;
rot: number; // 旋转角(度,绕文字框中心)
// 花字样式(模板套用,均可空)
grad?: [string, string] | null; // 渐变填充
stroke?: string | null; // 描边色
strokeW?: number; // 描边宽(相对字号比例)
shadow?: string | null; // 投影色
badge?: string | null; // 色块底(红底白字类)
}
// ---------- 文字花字模板(点击即套用,之后可继续调内容/字号/位置/旋转) ----------
interface TextTpl {
id: string; name: string; color: string;
grad?: [string, string]; bold?: boolean;
stroke?: string; strokeW?: number; shadow?: string; badge?: string;
}
const TEXT_TPLS: TextTpl[] = [
{ id: 'wp', name: '白字黑描边', color: '#ffffff', stroke: '#1a1a1a', strokeW: 0.10, bold: true },
{ id: 'yp', name: '黄字紫描边', color: '#ffe14d', stroke: '#7b2cbf', strokeW: 0.10, bold: true },
{ id: 'wpu', name: '白字紫描边', color: '#ffffff', stroke: '#8e44ad', strokeW: 0.09, bold: true },
{ id: 'yc', name: '黄字青描边', color: '#ffeb3b', stroke: '#00e5ff', strokeW: 0.11, bold: true },
{ id: 'rb', name: '红底白字', color: '#ffffff', badge: '#e53935', bold: true },
{ id: 'bb', name: '蓝底白字', color: '#ffffff', badge: '#1e88e5', bold: true },
{ id: 'kb', name: '黑底黄字', color: '#ffd600', badge: '#212121', bold: true },
{ id: 'gd', name: '鎏金渐变', color: '#ffcc00', grad: ['#fff3b0', '#ff9500'], stroke: '#7a4a00', strokeW: 0.07, bold: true },
{ id: 'fg', name: '烈焰渐变', color: '#ff4d4f', grad: ['#ff5252', '#ff8f00'], stroke: '#7a1f00', strokeW: 0.08, bold: true },
{ id: 'ws', name: '白字投影', color: '#ffffff', shadow: 'rgba(0,0,0,0.75)', bold: true },
{ id: 'cb', name: '青字黑描边', color: '#18ffff', stroke: '#00364d', strokeW: 0.10, bold: true },
{ id: 'pb', name: '粉底白字', color: '#ffffff', badge: '#ec407a', bold: true },
{ id: 'ol', name: '空心描边', color: 'rgba(255,255,255,0.06)', stroke: '#2962ff', strokeW: 0.10, bold: true },
{ id: 'gb', name: '荧光绿描边', color: '#76ff03', stroke: '#1b3d00', strokeW: 0.09, bold: true },
];
interface FillLayer {
id: string; type: 'fill'; name: string; visible: boolean; opacity: number;
x: number; y: number; w: number; h: number; color: string;
@@ -81,7 +111,9 @@ const statusHint = computed(() => {
return '拖拽框选,松手后可「消除选区内容」(无痕去文字/水印)或填充/清除';
}
if (tool.value === 'text') {
return '点击画布放置文字层';
return activeLayer.value?.type === 'text'
? '拖动文字可移动;拖顶部蓝点旋转(Shift 吸附15°);右侧模板一键换花字'
: '点击画布放置文字,或右侧直接点模板插入;拖顶部蓝点可旋转';
}
if (tool.value === 'fill') {
return '点击图片相近颜色区域填充(容差 ' + tolerance.value + ')';
@@ -148,7 +180,11 @@ async function restoreState(s: string): Promise<void> {
ls.push({ id: raw.id, type: 'paint', name: raw.name, visible: raw.visible, opacity: raw.opacity, ox: raw.ox ?? 0, oy: raw.oy ?? 0, canvas: c });
}
else {
ls.push(raw as Layer);
const l = raw as Layer;
if (l.type === 'text' && l.rot === undefined) {
l.rot = 0; // 兼容旧历史数据
}
ls.push(l);
}
}
layers.value = ls;
@@ -219,10 +255,7 @@ function drawLayerTo(ctx: CanvasRenderingContext2D, l: Layer): void {
ctx.fillRect(l.x, l.y, l.w, l.h);
}
else if (l.type === 'text') {
ctx.font = `${l.bold ? 'bold ' : ''}${l.size}px "Microsoft YaHei","PingFang SC","Noto Sans CJK SC","Source Han Sans SC",sans-serif`;
ctx.fillStyle = l.color;
ctx.textBaseline = 'top';
ctx.fillText(l.text, l.x, l.y);
drawTextLayer(ctx, l);
}
ctx.globalAlpha = 1;
}
@@ -268,6 +301,111 @@ function getChecker(ctx: CanvasRenderingContext2D): CanvasPattern {
return checkerPattern;
}
// 文字层几何:以文字框中心为旋转锚点
function textCenter(l: TextLayer): { x: number; y: number } {
const m = textMetrics(l);
return { x: l.x + m.w / 2, y: l.y + m.h / 2 };
}
// 旋转手柄位置(框顶部中心外推 26px 屏幕距离)
function textHandlePos(l: TextLayer): { x: number; y: number } {
const m = textMetrics(l);
const c = textCenter(l);
const dist = m.h / 2 + 26 / zoom.value;
const a = (l.rot * Math.PI) / 180;
return { x: c.x + Math.sin(a) * dist, y: c.y - Math.cos(a) * dist };
}
// 旋转命中:把点逆旋转回文字局部空间再比对
function textHitTest(l: TextLayer, dx: number, dy: number): boolean {
const m = textMetrics(l);
const c = textCenter(l);
const a = (-l.rot * Math.PI) / 180;
const ox = dx - c.x;
const oy = dy - c.y;
const rx = ox * Math.cos(a) - oy * Math.sin(a);
const ry = ox * Math.sin(a) + oy * Math.cos(a);
return Math.abs(rx) <= m.w / 2 + 6 && Math.abs(ry) <= m.h / 2 + 6;
}
// 花字绘制:色块底 → 投影 → 描边 → 渐变/纯色填充(绕文字框中心旋转)
function drawTextLayer(ctx: CanvasRenderingContext2D, l: TextLayer): void {
const font = `${l.bold ? 'bold ' : ''}${l.size}px "Microsoft YaHei","PingFang SC","Noto Sans CJK SC","Source Han Sans SC",sans-serif`;
ctx.font = font;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
const w = ctx.measureText(l.text).width;
const h = l.size * 1.25;
const cx = l.x + w / 2;
const cy = l.y + h / 2;
ctx.save();
ctx.translate(cx, cy);
if (l.rot) {
ctx.rotate((l.rot * Math.PI) / 180);
}
// 1) 色块底(红底白字类,四周留字距)
if (l.badge) {
const px = l.size * 0.32;
const py = l.size * 0.24;
const bx = -w / 2 - px;
const by = -h / 2 - py;
const bw = w + px * 2;
const bh = h + py * 2;
const r = Math.min(bh / 2, l.size * 0.18);
ctx.fillStyle = l.badge;
ctx.beginPath();
ctx.moveTo(bx + r, by);
ctx.lineTo(bx + bw - r, by);
ctx.arcTo(bx + bw, by, bx + bw, by + r, r);
ctx.lineTo(bx + bw, by + bh - r);
ctx.arcTo(bx + bw, by + bh, bx + bw - r, by + bh, r);
ctx.lineTo(bx + r, by + bh);
ctx.arcTo(bx, by + bh, bx, by + bh - r, r);
ctx.lineTo(bx, by + r);
ctx.arcTo(bx, by, bx + r, by, r);
ctx.closePath();
ctx.fill();
}
// 2) 投影
if (l.shadow) {
ctx.shadowColor = l.shadow;
ctx.shadowBlur = l.size * 0.22;
ctx.shadowOffsetX = l.size * 0.07;
ctx.shadowOffsetY = l.size * 0.1;
}
// 3) 描边(描边宽 = strokeW × 字号,居中描边故 ×2)
if (l.stroke) {
ctx.lineJoin = 'round';
ctx.miterLimit = 2;
ctx.lineWidth = (l.strokeW ?? 0.08) * l.size * 2;
ctx.strokeStyle = l.stroke;
ctx.strokeText(l.text, 0, 0);
// 去投影再填充,避免填充被投影糊掉
ctx.shadowColor = 'transparent';
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
}
// 4) 填充(渐变或纯色)
if (l.grad) {
const g = ctx.createLinearGradient(-w / 2, 0, w / 2, 0);
g.addColorStop(0, l.grad[0]);
g.addColorStop(1, l.grad[1]);
ctx.fillStyle = g;
}
else {
ctx.fillStyle = l.color;
}
ctx.fillText(l.text, 0, 0);
ctx.restore();
ctx.shadowColor = 'transparent';
ctx.shadowBlur = 0;
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
ctx.textAlign = 'start';
ctx.textBaseline = 'alphabetic';
}
function textMetrics(l: TextLayer): { w: number; h: number } {
const c = viewCanvas.value ?? document.createElement('canvas');
const ctx = c.getContext('2d')!;
@@ -324,7 +462,28 @@ function render(): void {
ctx.setLineDash([5 / zoom.value, 3 / zoom.value]);
if (al.type === 'text') {
const m = textMetrics(al);
ctx.strokeRect(al.x - 3 / zoom.value, al.y - 3 / zoom.value, m.w + 6 / zoom.value, m.h + 6 / zoom.value);
const c = textCenter(al);
ctx.save();
ctx.translate(c.x, c.y);
if (al.rot) {
ctx.rotate((al.rot * Math.PI) / 180);
}
ctx.strokeRect(-m.w / 2 - 3 / zoom.value, -m.h / 2 - 3 / zoom.value, m.w + 6 / zoom.value, m.h + 6 / zoom.value);
// 旋转手柄:框顶部中心外 26px(屏幕恒定距离)
ctx.setLineDash([]);
const hd = m.h / 2 + 26 / zoom.value;
ctx.beginPath();
ctx.moveTo(0, -m.h / 2 - 3 / zoom.value);
ctx.lineTo(0, -hd);
ctx.stroke();
ctx.beginPath();
ctx.arc(0, -hd, 5 / zoom.value, 0, Math.PI * 2);
ctx.fillStyle = '#2563eb';
ctx.fill();
ctx.strokeStyle = '#fff';
ctx.lineWidth = 1.5 / zoom.value;
ctx.stroke();
ctx.restore();
}
else if (al.type === 'fill') {
ctx.strokeRect(al.x, al.y, al.w, al.h);
@@ -523,7 +682,7 @@ function addPaintLayer(): void {
function addTextLayerAt(x: number, y: number): void {
const t = newText.value.trim() || '新文字';
const tl: TextLayer = { id: uid(), type: 'text', name: `文字「${t.slice(0, 8)}」`, visible: true, opacity: 100, text: t, x: Math.round(x), y: Math.round(y), size: fontSize.value, color: fontColor.value, bold: fontBold.value };
const tl: TextLayer = { id: uid(), type: 'text', name: `文字「${t.slice(0, 8)}」`, visible: true, opacity: 100, text: t, x: Math.round(x), y: Math.round(y), size: fontSize.value, color: fontColor.value, bold: fontBold.value, rot: 0 };
layers.value.push(tl);
activeLayerId.value = tl.id;
commit('添加文字');
@@ -531,6 +690,69 @@ function addTextLayerAt(x: number, y: number): void {
scheduleRender();
}
// 文字模板套用:已选文字层→即时换样式;未选→以当前输入文字在画布上部居中新建
function applyTpl(t: TextTpl): void {
const style = {
color: t.color,
bold: t.bold ?? true,
grad: (t.grad ?? null) as [string, string] | null,
stroke: (t.stroke ?? null) as string | null,
strokeW: t.strokeW ?? null,
shadow: (t.shadow ?? null) as string | null,
badge: (t.badge ?? null) as string | null,
};
const al = activeLayer.value;
if (al && al.type === 'text') {
Object.assign(al, style);
commitProps(); // 实时生效并进历史
return;
}
const content = newText.value.trim() || '新文字';
const tl: TextLayer = {
id: uid(), type: 'text', name: `文字「${content.slice(0, 8)}」`,
visible: true, opacity: 100, text: content,
x: 0, y: 0, size: fontSize.value, rot: 0, ...style,
};
layers.value.push(tl);
activeLayerId.value = tl.id;
const m = textMetrics(tl);
tl.x = Math.round((docW.value - m.w) / 2);
tl.y = Math.round(Math.max(8, docH.value * 0.1));
commit(`套用模板「${t.name}」`);
composite();
scheduleRender();
}
// 模板 chip 的 CSS 预览样式
function tplStyle(t: TextTpl): Record<string, string> {
const s: Record<string, string> = { fontWeight: '700', fontSize: '15px', lineHeight: '1.15' };
if (t.badge) {
s.background = t.badge;
s.color = t.color;
s.padding = '4px 7px';
s.borderRadius = '5px';
}
else if (t.grad) {
s.backgroundImage = `linear-gradient(90deg, ${t.grad[0]}, ${t.grad[1]})`;
s.backgroundClip = 'text';
s.WebkitBackgroundClip = 'text';
s.color = 'transparent';
if (t.stroke) {
s.WebkitTextStroke = `1px ${t.stroke}`;
}
}
else {
s.color = t.color;
if (t.stroke) {
s.WebkitTextStroke = `${Math.max(1, Math.round((t.strokeW ?? 0.08) * 16))}px ${t.stroke}`;
}
}
if (t.shadow) {
s.textShadow = `2px 2px 3px ${t.shadow}`;
}
return s;
}
function removeLayer(id: string): void {
const i = layers.value.findIndex(l => l.id === id);
if (i < 0 || layers.value[i].type === 'image') {
@@ -882,7 +1104,7 @@ function applyHitReplace(): void {
const fl: FillLayer = { id: uid(), type: 'fill', name: '擦除色块', visible: true, opacity: 100, x: Math.max(0, hit.x - padX), y: Math.max(0, hit.y - padY), w: hit.w + padX * 2, h: hit.h + padY * 2, color };
layers.value.push(fl);
const content = hitText.value.trim() || hit.text;
const tl: TextLayer = { id: uid(), type: 'text', name: `文字「${content.slice(0, 8)}」`, visible: true, opacity: 100, text: content, x: hit.x, y: hit.y + hit.h * 0.06, size: Math.max(10, Math.round(hit.h * 0.82)), color: '#000000', bold: false };
const tl: TextLayer = { id: uid(), type: 'text', name: `文字「${content.slice(0, 8)}」`, visible: true, opacity: 100, text: content, x: hit.x, y: hit.y + hit.h * 0.06, size: Math.max(10, Math.round(hit.h * 0.82)), color: '#000000', bold: false, rot: 0 };
layers.value.push(tl);
activeLayerId.value = tl.id;
hit.used = true;
@@ -1142,6 +1364,7 @@ function ocrHitTest(dx: number, dy: number): OcrHit | null {
let panning = false;
let panStart = { x: 0, y: 0, px: 0, py: 0 };
let moving: { layer: TextLayer | FillLayer | PaintLayer; offX: number; offY: number } | null = null;
let rotating: TextLayer | null = null; // 旋转手柄拖动中
let spaceDown = false;
function layerHitTest(dx: number, dy: number): TextLayer | FillLayer | PaintLayer | null {
@@ -1151,8 +1374,7 @@ function layerHitTest(dx: number, dy: number): TextLayer | FillLayer | PaintLaye
continue;
}
if (l.type === 'text') {
const m = textMetrics(l);
if (dx >= l.x - 4 && dx <= l.x + m.w + 4 && dy >= l.y - 4 && dy <= l.y + m.h + 4) {
if (textHitTest(l, dx, dy)) {
return l;
}
}
@@ -1193,6 +1415,15 @@ function onDown(e: PointerEvent): void {
return;
}
if (tool.value === 'move') {
// 优先:旋转手柄命中(仅当前选中文字层)
const al0 = activeLayer.value;
if (al0 && al0.type === 'text') {
const hp = textHandlePos(al0);
if (Math.hypot(p.x - hp.x, p.y - hp.y) <= 12 / zoom.value) {
rotating = al0;
return;
}
}
const lh = layerHitTest(p.x, p.y);
if (lh) {
activeLayerId.value = lh.id;
@@ -1266,6 +1497,17 @@ function onMove(e: PointerEvent): void {
scheduleRender();
return;
}
if (rotating) {
const c = textCenter(rotating);
let ang = (Math.atan2(p.y - c.y, p.x - c.x) * 180) / Math.PI + 90;
if (e.shiftKey) {
ang = Math.round(ang / 15) * 15; // Shift 吸附 15°
}
rotating.rot = Math.round(ang * 10) / 10;
composite(); // 实时重绘:拖动即看到文字跟着转
scheduleRender();
return;
}
if (moving) {
const l = moving.layer;
const nx = Math.round(p.x - moving.offX);
@@ -1358,6 +1600,12 @@ function onUp(): void {
scheduleRender();
return;
}
if (rotating) {
const r = Math.round(rotating.rot % 360);
rotating = null;
commit(`旋转文字 ${r}°`);
return;
}
if (moving) {
moving = null;
commit('移动图层');
@@ -1701,6 +1949,23 @@ onBeforeUnmount(() => {
</div>
</div>
</div>
<div v-if="tool === 'text' || activeLayer?.type === 'text'" class="psx-sec">
<div class="psx-sec-t">
文字模板
<span class="psx-tip">点击套用</span>
</div>
<div class="psx-tpl-grid">
<button
v-for="t in TEXT_TPLS"
:key="t.id"
class="psx-tpl"
:title="`${t.name} — ${activeLayer?.type === 'text' ? '应用到当前文字' : '插入并应用'}`"
@click="applyTpl(t)"
>
<span :style="tplStyle(t)">文字</span>
</button>
</div>
</div>
<div v-if="activeLayer && activeLayer.type !== 'image'" class="psx-sec">
<div class="psx-sec-t">属性</div>
<div class="psx-prop">
@@ -1727,6 +1992,21 @@ onBeforeUnmount(() => {
<input v-model="activeLayer.color" type="color" class="psx-color" @change="commitProps()">
<label class="psx-check"><input v-model="activeLayer.bold" type="checkbox" @change="commitProps()"> 加粗</label>
</div>
<div class="psx-prop">
<span class="psx-lb">旋转</span>
<input
v-model.number="activeLayer.rot"
type="range"
min="-180"
max="180"
class="psx-range"
@input="onLayerPropChange()"
@change="commitProps()"
>
<input v-model.number="activeLayer.rot" type="number" min="-180" max="180" class="psx-numin rot90" @change="commitProps()">
<span class="psx-lb">°</span>
<button class="psx-mini" title="画布上拖蓝色圆点可自由旋转,按 Shift 吸附 15°" @click="activeLayer.rot = 0; commitProps()">回正</button>
</div>
</template>
<template v-else-if="activeLayer.type === 'fill'">
<div class="psx-prop">
@@ -1908,6 +2188,39 @@ onBeforeUnmount(() => {
}
}
&-tpl-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 6px;
}
&-tpl {
height: 40px;
border: 1px solid rgba(128, 128, 128, 0.3);
border-radius: 7px;
background: rgba(128, 128, 128, 0.07);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: 0 3px;
transition: border-color 0.12s, transform 0.12s;
&:hover {
border-color: #2563eb;
transform: translateY(-1px);
}
&.on {
border-color: #2563eb;
background: rgba(37, 99, 235, 0.12);
}
}
&-rot90 {
width: 58px;
}
&-live {
display: inline-flex;
align-items: center;
@@ -1963,7 +2276,16 @@ onBeforeUnmount(() => {
display: flex;
flex-direction: column;
min-height: 0;
overflow-y: auto; // 模板库/属性/历史多区块时可滚动到底
background: var(--bg-color);
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: rgba(128, 128, 128, 0.35);
border-radius: 3px;
}
}
&-sec {
@@ -1975,7 +2297,6 @@ onBeforeUnmount(() => {
}
&-hist-sec {
flex: 1;
min-height: 0;
border-bottom: none;
}
@@ -2076,12 +2397,11 @@ onBeforeUnmount(() => {
}
&-hist {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 2px;
min-height: 60px;
max-height: 220px;
}
&-hitem {
+1 -1
View File
@@ -23,7 +23,7 @@ const TABS: TabDef[] = [
{ key: 'rotate', label: '旋转', desc: '旋转或翻转图片' },
{ key: 'filter', label: '滤镜', desc: '为图片应用滤镜效果(灰度/复古/模糊等)' },
{ key: 'mosaic', label: '打码', desc: '在图片上拖拽框选区域,马赛克或涂黑打码' },
{ key: 'edit', label: '图片编辑', desc: 'PS 风格图层编辑器:画笔/橡皮/文字/选区/油漆桶/吸管/裁剪,支持缩放平移、图层面板与历史记录;OCR 一键替换图中文字' },
{ key: 'edit', label: '图片编辑', desc: 'PS 风格图层编辑器:画笔/智能消除笔/文字/选区/油漆桶/吸管/裁剪,文字支持画布拖拽旋转+14款花字模板点击套用,消除实时预览,OCR 一键替换/消除图中文字' },
{ key: 'exif', label: 'EXIF 查看', desc: '查看拍摄设备、时间、参数等 EXIF 信息' },
{ key: 'qrgen', label: '二维码生成', desc: '把文字/链接生成为二维码图片', noFile: true },
{ key: 'qrread', label: '二维码识别', desc: '识别图片中的二维码/条码内容' },