Difference between revisions of "Diagrams/Dev/Migrate1.2"
Line 6: | Line 6: | ||
* To simply retain the existing behavior, replace <code>lw</code> with <code>lwG</code>, <code>dashing</code> with <code>dashingG</code>, and <code>fontSize</code> with <code>fontSizeL</code>. |
* To simply retain the existing behavior, replace <code>lw</code> with <code>lwG</code>, <code>dashing</code> with <code>dashingG</code>, and <code>fontSize</code> with <code>fontSizeL</code>. |
||
− | * In many cases, you can simply remove calls to <code>lw</code>, since the default behavior is much more sensible. You can also use the named line weights provided in <code>Diagrams.TwoD.Attributes</code>: <code>none</code>, <code>ultraThin</code>, <code>veryThin</code>, <code>thin</code>, <code>medium</code>, <code>thick</code>, <code>veryThick</code>, or <code>ultraThick</code>. For example, replace <code>lw 0</code> with <code>lw none</code>, and replace (say) <code>lw 0.2</code> with <code>lw veryThick</code>. |
+ | * In many cases, you can simply remove calls to <code>lw</code>, since the default behavior is much more sensible. You can also use the named line weights provided in <code>Diagrams.TwoD.Attributes</code>: <code>none</code>, <code>ultraThin</code>, <code>veryThin</code>, <code>thin</code>, <code>medium</code>, <code>thick</code>, <code>veryThick</code>, or <code>ultraThick</code>. For example, replace <code>lw 0</code> with <code>lw none</code>, and replace (say) <code>lw 0.2</code> with <code>lw veryThick</code> (though note that the relationship between the number used previously and the proper choice of line weight depends on the context, because the old semantics was not very sensible). |
== Removal of <code>freeze</code> == |
== Removal of <code>freeze</code> == |
Revision as of 14:43, 2 June 2014
This page describes breaking API changes between diagrams 1.1 and 1.2, along with explanations of how to migrate to the new 1.2 API.
Attributes using Measure
Many distances are now specified using values of type Measure
. See the user manual for full details. The most noticeable effects of this change in porting diagrams code to 1.2 will be type errors on uses of attribute functions like lw
, dashing
, and fontSize
.
- To simply retain the existing behavior, replace
lw
withlwG
,dashing
withdashingG
, andfontSize
withfontSizeL
. - In many cases, you can simply remove calls to
lw
, since the default behavior is much more sensible. You can also use the named line weights provided inDiagrams.TwoD.Attributes
:none
,ultraThin
,veryThin
,thin
,medium
,thick
,veryThick
, orultraThick
. For example, replacelw 0
withlw none
, and replace (say)lw 0.2
withlw veryThick
(though note that the relationship between the number used previously and the proper choice of line weight depends on the context, because the old semantics was not very sensible).
Removal of freeze
The freeze
function has been removed. Most users probably were not using it; if you were, you have several options for replacing it, depending on how you were using it:
- If you were just using it to get some lines to scale along with a diagram, use a
Local
line width (e.g.... # lw (Local 2)
or... # lwL 2
). - The above will not work if you were doing non-uniform scaling and really care that the lines should come out looking squished and stretched. In that case, use functions in
Diagrams.TwoD.Offset
to create a path corresponding to the stroked line, and then fill and transform it normally.
Arrows
The size of arrow heads and tails is now specified in terms of length instead of the radius of their circumcircle.
Gaps at the ends of arrows are now specified using Measure R2
.
The gap
traversal has been replaced by `gaps` for consistency in naming, though gap
is still provided for backwards compatibility.
Reorganization
The avgScale
function has been moved from Diagrams.TwoD.Transform
to Diagrams.Core.Transform
.
Most (all?) 2D attributes have been moved from Diagrams.Attributes
to Diagrams.TwoD.Attributes
.
The Angle
definition and related functions have moved to a separate module, Diagrams.Angle
.