You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/draw/grouping.typ
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -337,17 +337,24 @@
337
337
)
338
338
},)
339
339
340
-
/// Creates a new anchor for the current group. This element can only be used inside a group otherwise it will panic. The new anchor will be accessible from inside the group by using just the anchor's name as a coordinate.
340
+
/// Creates a new anchor for the current group. The new anchor will be accessible from inside the group by using just the anchor's name as a coordinate.
341
341
///
342
342
/// ```typc example
343
-
/// // Create group
343
+
/// // Inside a group
344
344
/// group(name: "g", {
345
345
/// circle((0,0))
346
346
/// anchor("x", (.4, .1))
347
347
/// circle("x", radius: .2)
348
348
/// })
349
349
/// circle("g.x", radius: .1)
350
350
/// ```
351
+
352
+
/// ```typc example
353
+
/// // At the root scope
354
+
/// anchor("x", (1, 1))
355
+
/// // ...
356
+
/// circle("x", radius: .1)
357
+
/// ```
351
358
///
352
359
/// - name (str): The name of the anchor
353
360
/// - position (coordinate): The position of the anchor
@@ -357,10 +364,6 @@
357
364
358
365
coordinate.resolve-system(position)
359
366
return (ctx=> {
360
-
assert(
361
-
ctx.groups.len() >0,
362
-
message: "Anchor '"+name+"' created outside of group!",
363
-
)
364
367
let (ctx, position) = coordinate.resolve(ctx, position)
0 commit comments