diff --git a/frontend/canvas.html b/frontend/canvas.html index a33f56e..e3e3b48 100644 --- a/frontend/canvas.html +++ b/frontend/canvas.html @@ -1622,7 +1622,7 @@ Organization : OptiHK Limited // Displays a category icon with cached loading and graceful failure behavior. - const IconImg = memo(({ category, containerStyle }) => { + const IconImg = memo(({ category, containerStyle, objectFit: imgObjectFit }) => { const [src, setSrc] = useState(() => { if (!category) return undefined; const cache = fetchIcon(category); @@ -1671,7 +1671,7 @@ Organization : OptiHK Limited style={{ width: '100%', height: '100%', - objectFit: 'fill', + objectFit: imgObjectFit || 'fill', pointerEvents: 'none', }} onError={(e) => { @@ -1721,7 +1721,7 @@ Organization : OptiHK Limited }; const componentSize = normalizeBoxSize({ box_size: data.boxSize }, DEFAULT_COMPONENT_BOX_SIZE); const portHandles = useMemo( - () => buildPortHandles(data.ports, { rotation: 0, flip: Boolean(data.flip), flop: Boolean(data.flop), boxSize: componentSize }), + () => buildPortHandles(data.ports, { rotation: data.rotation || 0, flip: Boolean(data.flip), flop: Boolean(data.flop), boxSize: componentSize }), [data.ports, data.rotation, data.flip, data.flop, componentSize] ); const portDirectionMap = useMemo( @@ -1735,17 +1735,16 @@ Organization : OptiHK Limited const iconSize = createComponentSymbolMetrics(componentSize); const portLabelStyle = (portHandle) => { const base = { ...portHandle.style }; - const unrotate = `rotate(${-(data.rotation || 0)}deg) scaleX(${data.flop ? -1 : 1}) scaleY(${data.flip ? -1 : 1})`; if (portHandle.position === 'left') { - return { ...base, left: 'auto', right: 'calc(100% + 8px)', transform: `translateY(-50%) ${unrotate}`, textAlign: 'right' }; + return { ...base, left: 'auto', right: 'calc(100% + 8px)', transform: 'translateY(-50%)', textAlign: 'right' }; } if (portHandle.position === 'right') { - return { ...base, left: 'calc(100% + 8px)', right: 'auto', transform: `translateY(-50%) ${unrotate}`, textAlign: 'left' }; + return { ...base, left: 'calc(100% + 8px)', right: 'auto', transform: 'translateY(-50%)', textAlign: 'left' }; } if (portHandle.position === 'top') { - return { ...base, top: 'auto', bottom: 'calc(100% + 8px)', transform: `translateX(-50%) ${unrotate}`, textAlign: 'center' }; + return { ...base, top: 'auto', bottom: 'calc(100% + 8px)', transform: 'translateX(-50%)', textAlign: 'center' }; } - return { ...base, top: 'calc(100% + 8px)', bottom: 'auto', transform: `translateX(-50%) ${unrotate}`, textAlign: 'center' }; + return { ...base, top: 'calc(100% + 8px)', bottom: 'auto', transform: 'translateX(-50%)', textAlign: 'center' }; }; return ( @@ -1759,19 +1758,18 @@ Organization : OptiHK Limited {data.componentName} )} -