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
the anchor of the image. Available values are ``:top_left``, ``:top_right``, ``:bottom_left``, ``:bottom_right``, and ``:middle`` or ``:center``. The first 4 options anchor the image relative to the corresponding corner, and ``:middle`` and ``:center`` set the anchor to the middle of the image
Copy file name to clipboardExpand all lines: docs/dsl/png.rst
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ file
12
12
13
13
file(s) to read in. As in :doc:`/arrays`, if this a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done for that card.
Copy file name to clipboardExpand all lines: lib/squib/args/scale_box.rb
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ class ScaleBox
13
13
defself.parameters
14
14
{
15
15
x: 0,y: 0,
16
-
width: :native,height: :native
16
+
width: :native,height: :native,
17
+
anchor: :top_left
17
18
}
18
19
end
19
20
@@ -52,6 +53,11 @@ def validate_height(arg, i)
52
53
raise'height must be a number, :scale, :native, or :deck'
53
54
end
54
55
56
+
defvalidate_anchor(arg,i)
57
+
raise'anchor must be one of :top_left, :top_right, :bottom_left, :bottom_right, or :center/:middle'unless[:top_left,:top_right,:bottom_left,:bottom_right,:center,:middle].include?arg
Copy file name to clipboardExpand all lines: spec/args/scale_box_spec.rb
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,17 @@
64
64
expect{Squib::Args.extract_scale_boxargs,deck}.toraise_error('height must be a number, :scale, :native, or :deck')
65
65
end
66
66
67
+
it'allows setting anchors'do
68
+
args={anchor: :middle}
69
+
box=Squib::Args.extract_scale_boxargs,deck
70
+
expect(box).tohave_attributes(anchor: [:middle])
71
+
end
72
+
73
+
it'disallows setting incorrect anchors'do
74
+
args={anchor: :midle}
75
+
expect{Squib::Args.extract_scale_boxargs,deck}.toraise_error('anchor must be one of :top_left, :top_right, :bottom_left, :bottom_right, or :center/:middle')
0 commit comments