@@ -20,16 +20,19 @@ Rectangle {
2020 return graph .isNodeSelected (nodeId)
2121 }
2222
23+ // Style shortcut - use direct access for reactivity
24+ property var style: graph ? graph .style : null
25+
2326 x: initialX
2427 y: initialY
2528
26- width: 150
27- height: Math .max (Math .max (inPorts, outPorts) * 20 + 40 , 50 )
29+ width: style . nodeMinWidth
30+ height: Math .max (Math .max (inPorts, outPorts) * ( style . portSize + style . nodePortSpacing ) + style . nodeHeaderHeight + 5 , 50 )
2831
29- color: " #2d2d2d "
30- border .color : selected ? " #4a9eff " : " black "
31- border .width : selected ? 3 : 2
32- radius: 5
32+ color: style . nodeBackground
33+ border .color : selected ? style . nodeSelectedBorder : style . nodeBorder
34+ border .width : selected ? style . nodeSelectedBorderWidth : style . nodeBorderWidth
35+ radius: style . nodeRadius
3336
3437 Component .onCompleted : {
3538 completed = true
@@ -108,17 +111,18 @@ Rectangle {
108111 anchors .top : parent .top
109112 anchors .topMargin : 8
110113 text: caption
111- color: " #eeeeee"
112- font .bold : true
114+ color: graph && graph .style ? graph .style .nodeCaptionColor : " #eeeeee"
115+ font .bold : graph && graph .style ? graph .style .nodeCaptionBold : true
116+ font .pixelSize : graph && graph .style ? graph .style .nodeCaptionFontSize : 12
113117 }
114118
115119 Loader {
116120 id: contentLoader
117121 anchors .top : parent .top
118- anchors .topMargin : 35
122+ anchors .topMargin : style . nodeHeaderHeight
119123 anchors .horizontalCenter : parent .horizontalCenter
120124 width: parent .width - 20
121- height: parent .height - 50
125+ height: parent .height - style . nodeHeaderHeight - 15
122126 sourceComponent: contentDelegate
123127
124128 onLoaded: {
@@ -146,35 +150,34 @@ Rectangle {
146150 z: 10
147151 anchors .left : parent .left
148152 anchors .top : parent .top
149- anchors .topMargin : 35
150- anchors .leftMargin : - 5 // Overlap edge
151- spacing: 10
153+ anchors .topMargin : style . nodeHeaderHeight
154+ anchors .leftMargin : - style . portSize / 2 + 1
155+ spacing: style . nodePortSpacing
152156
153157 Repeater {
154158 id: inRepeater
155159 model: inPorts
156160 delegate: Rectangle {
157161 id: inPortRect
158- width: 12 ; height: 12
159- radius: 6
162+ width: style . portSize ; height: style . portSize
163+ radius: style . portSize / 2
160164 property string portTypeId: graph .getPortTypeId (root .nodeId , 0 , index)
161165 property bool isCompatible: ! graph .isDragging ||
162166 (graph .activeConnectionStart && graph .activeConnectionStart .portType === 1 &&
163167 graph .draftConnectionTypeId === portTypeId)
164168 property bool isDimmed: graph .isDragging && ! isCompatible
165169 color: graph .getPortColor (portTypeId)
166- opacity: isDimmed ? 0.3 : 1.0
167- border .color : isCompatible && graph .isDragging ? " #ffffff " : " black "
168- border .width : isCompatible && graph .isDragging ? 2 : 1
170+ opacity: isDimmed ? style . portDimmedOpacity : 1.0
171+ border .color : isCompatible && graph .isDragging ? style . portHighlightBorder : style . portBorderColor
172+ border .width : isCompatible && graph .isDragging ? style . portHighlightBorderWidth : style . portBorderWidth
169173
170174 MouseArea {
171175 anchors .fill : parent
172176 hoverEnabled: true
173177 preventStealing: true
174178 onEntered: {
175- // Only highlight if not dragging or if we are the target
176179 if (! graph .isDragging ) {
177- parent .scale = 1.2
180+ parent .scale = style . portHoverScale
178181 graph .setActivePort ({nodeId: root .nodeId , portType: 0 , portIndex: index})
179182 }
180183 }
@@ -185,12 +188,11 @@ Rectangle {
185188 }
186189 }
187190
188- // Visual feedback based on activePort
189191 property bool isActive: {
190192 var ap = graph .activePort
191193 return ap && ap .nodeId === root .nodeId && ap .portType === 0 && ap .portIndex === index
192194 }
193- onIsActiveChanged: parent .scale = isActive ? 1.4 : 1.0
195+ onIsActiveChanged: parent .scale = isActive ? style . portActiveScale : 1.0
194196 onPressed : (mouse ) => {
195197 var existing = graph .graphModel .getConnectionAtInput (root .nodeId , index)
196198 var mousePos = mapToItem (graph .canvas , mouse .x , mouse .y )
@@ -226,34 +228,34 @@ Rectangle {
226228 z: 10
227229 anchors .right : parent .right
228230 anchors .top : parent .top
229- anchors .topMargin : 35
230- anchors .rightMargin : - 5
231- spacing: 10
231+ anchors .topMargin : style . nodeHeaderHeight
232+ anchors .rightMargin : - style . portSize / 2 + 1
233+ spacing: style . nodePortSpacing
232234
233235 Repeater {
234236 id: outRepeater
235237 model: outPorts
236238 delegate: Rectangle {
237239 id: outPortRect
238- width: 12 ; height: 12
239- radius: 6
240+ width: style . portSize ; height: style . portSize
241+ radius: style . portSize / 2
240242 property string portTypeId: graph .getPortTypeId (root .nodeId , 1 , index)
241243 property bool isCompatible: ! graph .isDragging ||
242244 (graph .activeConnectionStart && graph .activeConnectionStart .portType === 0 &&
243245 graph .draftConnectionTypeId === portTypeId)
244246 property bool isDimmed: graph .isDragging && ! isCompatible
245247 color: graph .getPortColor (portTypeId)
246- opacity: isDimmed ? 0.3 : 1.0
247- border .color : isCompatible && graph .isDragging ? " #ffffff " : " black "
248- border .width : isCompatible && graph .isDragging ? 2 : 1
248+ opacity: isDimmed ? style . portDimmedOpacity : 1.0
249+ border .color : isCompatible && graph .isDragging ? style . portHighlightBorder : style . portBorderColor
250+ border .width : isCompatible && graph .isDragging ? style . portHighlightBorderWidth : style . portBorderWidth
249251
250252 MouseArea {
251253 anchors .fill : parent
252254 hoverEnabled: true
253255 preventStealing: true
254256 onEntered: {
255257 if (! graph .isDragging ) {
256- parent .scale = 1.2
258+ parent .scale = style . portHoverScale
257259 graph .setActivePort ({nodeId: root .nodeId , portType: 1 , portIndex: index})
258260 }
259261 }
@@ -268,7 +270,7 @@ Rectangle {
268270 var ap = graph .activePort
269271 return ap && ap .nodeId === root .nodeId && ap .portType === 1 && ap .portIndex === index
270272 }
271- onIsActiveChanged: parent .scale = isActive ? 1.4 : 1.0
273+ onIsActiveChanged: parent .scale = isActive ? style . portActiveScale : 1.0
272274
273275 onPressed : (mouse ) => {
274276 var pos = mapToItem (graph .canvas , width/ 2 , height/ 2 )
0 commit comments