@@ -148,6 +148,7 @@ class SvgRoundedModuleDrawer(SvgPathQRModuleDrawer):
148148 means that the radius of the rounded edge will be 0 (and thus back to 90
149149 degrees again).
150150 """
151+
151152 needs_neighbors = True
152153
153154 def __init__ (self , radius_ratio : Decimal = Decimal (1 ), ** kwargs ):
@@ -161,9 +162,9 @@ def initialize(self, *args, **kwargs) -> None:
161162 def drawrect (self , box , is_active ):
162163 if not is_active :
163164 return
164-
165+
165166 # Check if is_active has neighbor information (ActiveWithNeighbors object)
166- if hasattr (is_active , 'N' ):
167+ if hasattr (is_active , "N" ):
167168 # Neighbor information is available
168169 self .img ._subpaths .append (self .subpath (box , is_active ))
169170 else :
@@ -178,36 +179,36 @@ def subpath_all_rounded(self, box) -> str:
178179 x1 = self .img .units (coords .x1 , text = False )
179180 y1 = self .img .units (coords .y1 , text = False )
180181 r = self .img .units (self .corner_radius , text = False )
181-
182+
182183 # Build the path with all corners rounded
183184 path = []
184-
185+
185186 # Start at top-left after the rounded part
186187 path .append (f"M{ x0 + r } ,{ y0 } " )
187-
188+
188189 # Top edge to top-right corner
189190 path .append (f"H{ x1 - r } " )
190191 # Top-right rounded corner
191192 path .append (f"A{ r } ,{ r } 0 0 1 { x1 } ,{ y0 + r } " )
192-
193+
193194 # Right edge to bottom-right corner
194195 path .append (f"V{ y1 - r } " )
195196 # Bottom-right rounded corner
196197 path .append (f"A{ r } ,{ r } 0 0 1 { x1 - r } ,{ y1 } " )
197-
198+
198199 # Bottom edge to bottom-left corner
199200 path .append (f"H{ x0 + r } " )
200201 # Bottom-left rounded corner
201202 path .append (f"A{ r } ,{ r } 0 0 1 { x0 } ,{ y1 - r } " )
202-
203+
203204 # Left edge to top-left corner
204205 path .append (f"V{ y0 + r } " )
205206 # Top-left rounded corner
206207 path .append (f"A{ r } ,{ r } 0 0 1 { x0 + r } ,{ y0 } " )
207-
208+
208209 # Close the path
209210 path .append ("z" )
210-
211+
211212 return "" .join (path )
212213
213214 def subpath (self , box , is_active ) -> str :
@@ -217,58 +218,58 @@ def subpath(self, box, is_active) -> str:
217218 ne_rounded = not is_active .N and not is_active .E
218219 se_rounded = not is_active .E and not is_active .S
219220 sw_rounded = not is_active .S and not is_active .W
220-
221+
221222 coords = self .coords (box )
222223 x0 = self .img .units (coords .x0 , text = False )
223224 y0 = self .img .units (coords .y0 , text = False )
224225 x1 = self .img .units (coords .x1 , text = False )
225226 y1 = self .img .units (coords .y1 , text = False )
226227 r = self .img .units (self .corner_radius , text = False )
227-
228+
228229 # Build the path
229230 path = []
230-
231+
231232 # Start at top-left and move clockwise
232233 if nw_rounded :
233234 # Start at top-left corner, after the rounded part
234235 path .append (f"M{ x0 + r } ,{ y0 } " )
235236 else :
236237 # Start at the top-left corner
237238 path .append (f"M{ x0 } ,{ y0 } " )
238-
239+
239240 # Top edge to top-right corner
240241 if ne_rounded :
241242 path .append (f"H{ x1 - r } " )
242243 # Top-right rounded corner
243244 path .append (f"A{ r } ,{ r } 0 0 1 { x1 } ,{ y0 + r } " )
244245 else :
245246 path .append (f"H{ x1 } " )
246-
247+
247248 # Right edge to bottom-right corner
248249 if se_rounded :
249250 path .append (f"V{ y1 - r } " )
250251 # Bottom-right rounded corner
251252 path .append (f"A{ r } ,{ r } 0 0 1 { x1 - r } ,{ y1 } " )
252253 else :
253254 path .append (f"V{ y1 } " )
254-
255+
255256 # Bottom edge to bottom-left corner
256257 if sw_rounded :
257258 path .append (f"H{ x0 + r } " )
258259 # Bottom-left rounded corner
259260 path .append (f"A{ r } ,{ r } 0 0 1 { x0 } ,{ y1 - r } " )
260261 else :
261262 path .append (f"H{ x0 } " )
262-
263+
263264 # Left edge back to start
264265 if nw_rounded :
265266 path .append (f"V{ y0 + r } " )
266267 # Top-left rounded corner
267268 path .append (f"A{ r } ,{ r } 0 0 1 { x0 + r } ,{ y0 } " )
268269 else :
269270 path .append (f"V{ y0 } " )
270-
271+
271272 # Close the path
272273 path .append ("z" )
273-
274+
274275 return "" .join (path )
0 commit comments