Fix DPM/MCM bindings: elements[0].fill.paint (not elements[1])

Matches Example pattern — first triangle path gets the color binding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-04-01 19:21:36 +04:00
parent ba9b45a43e
commit 12a2ad62bf

View File

@ -315,6 +315,7 @@ function generateElementBindings(elements: SvgElement[]): Record<string, any> {
// Sub-element fill bindings — varies by device type // Sub-element fill bindings — varies by device type
const isButton = /_(?:JR|S|SS|EN)\d/i.test(elName); const isButton = /_(?:JR|S|SS|EN)\d/i.test(elName);
const isDpm = /_DPM\d*/i.test(elName); const isDpm = /_DPM\d*/i.test(elName);
const isMcm = /^MCM\d*/i.test(elName);
const isEpc = /_EPC\d*/i.test(elName); const isEpc = /_EPC\d*/i.test(elName);
if (el.elements && el.elements.length > 0) { if (el.elements && el.elements.length > 0) {
@ -325,12 +326,9 @@ function generateElementBindings(elements: SvgElement[]): Record<string, any> {
if (el.elements.length > 1 && el.elements[1].elements && el.elements[1].elements.length > 1) { if (el.elements.length > 1 && el.elements[1].elements && el.elements[1].elements.length > 1) {
propConfig[`${prefix}.elements[1].elements[1].fill.paint`] = fillPaintBinding(n); propConfig[`${prefix}.elements[1].elements[1].fill.paint`] = fillPaintBinding(n);
} }
} else if (isDpm) { } else if (isDpm || isMcm) {
// DPM: only elements[1] gets color binding (the black triangle) // DPM/MCM: only elements[0].fill.paint gets color binding
// elements[0] stays as-is, elements[2] is transparent propConfig[`${prefix}.elements[0].fill.paint`] = fillPaintBinding(n);
if (el.elements.length > 1) {
propConfig[`${prefix}.elements[1].fill.paint`] = fillPaintBinding(n);
}
} else if (isButton) { } else if (isButton) {
// Buttons: NO fill binding on elements[0] (background rect keeps static color) // Buttons: NO fill binding on elements[0] (background rect keeps static color)
// Only text elements get contrast color binding // Only text elements get contrast color binding