Fix MCM and EPC missing tagpaths/color/state/priority
MCM: was returning null for tagpath — now gets System/{mcm}/MCM09
EPC: emitEpc() was building <g> without Ignition data attributes —
now includes igAttrs (data-tagpath, data-color, data-state, data-priority)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
015e2406b0
commit
0ace92e15d
@ -143,7 +143,7 @@ function stripButtonSuffix(label: string): string {
|
|||||||
|
|
||||||
function getIgnitionTagPath(label: string, mcm: string): string | null {
|
function getIgnitionTagPath(label: string, mcm: string): string | null {
|
||||||
if (!label) return null;
|
if (!label) return null;
|
||||||
if (/^MCM\d*/i.test(label)) return null;
|
if (/^MCM\d*/i.test(label)) return `System/${mcm}/${label}`;
|
||||||
for (const rule of TAG_PATH_RULES) {
|
for (const rule of TAG_PATH_RULES) {
|
||||||
if (rule.pattern.test(label)) return `System/${mcm}/${rule.path}/${stripButtonSuffix(label)}`;
|
if (rule.pattern.test(label)) return `System/${mcm}/${rule.path}/${stripButtonSuffix(label)}`;
|
||||||
}
|
}
|
||||||
@ -650,7 +650,8 @@ async function emitEpc(lines: string[], sym: PlacedSymbol, label: string, outerT
|
|||||||
parts.push(` <rect x="${-rb.w}" y="${-rb.h / 2}" width="${rb.w}" height="${rb.h}" fill="#aaaaaa" stroke="#000000" stroke-width="${EPC_CONFIG.lineWidth}" transform="translate(${plx},${ply}) rotate(${rAngle.toFixed(2)})" />`);
|
parts.push(` <rect x="${-rb.w}" y="${-rb.h / 2}" width="${rb.w}" height="${rb.h}" fill="#aaaaaa" stroke="#000000" stroke-width="${EPC_CONFIG.lineWidth}" transform="translate(${plx},${ply}) rotate(${rAngle.toFixed(2)})" />`);
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.push(` <g id="${label}" inkscape:label="${label}"${tAttr}>`);
|
const igAttrs = getIgnitionAttrs(label);
|
||||||
|
lines.push(` <g id="${label}" inkscape:label="${label}"${igAttrs}${tAttr}>`);
|
||||||
lines.push(parts.join('\n'));
|
lines.push(parts.join('\n'));
|
||||||
lines.push(' </g>');
|
lines.push(' </g>');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user