fix: SVG 图标覆盖的文字自动移除
imageRects 现在包含 RECTANGLE+backgroundImages 的节点(SVG 图标), 覆盖检测正确识别图标与文字的重叠。
This commit is contained in:
+2
-2
@@ -631,8 +631,8 @@ async function convert(input) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ===== 同坐标完全重叠去重:保留后者(高层),仅同类型 =====
|
// ===== 同坐标完全重叠去重:保留后者(高层),仅同类型 =====
|
||||||
// 额外:IMAGE 节点覆盖的 TEXT 节点也去掉(图片替代文字)
|
// 额外:IMAGE/RECTANGLE(有背景图) 节点覆盖的 TEXT 节点也去掉
|
||||||
var imageRects = sg.children.filter(c => c.type === 'IMAGE' && c.rect).map(c => ({
|
var imageRects = sg.children.filter(c => (c.type === 'IMAGE' || (c.type === 'RECTANGLE' && c.backgroundImages?.length > 0)) && c.rect).map(c => ({
|
||||||
x: Math.round(c.rect.x), y: Math.round(c.rect.y),
|
x: Math.round(c.rect.x), y: Math.round(c.rect.y),
|
||||||
w: Math.round(c.rect.w), h: Math.round(c.rect.h),
|
w: Math.round(c.rect.w), h: Math.round(c.rect.h),
|
||||||
z: parseInt(c.styles?.zIndex) || 0
|
z: parseInt(c.styles?.zIndex) || 0
|
||||||
|
|||||||
Reference in New Issue
Block a user