From: Ian Jackson Date: Sun, 23 May 2021 00:56:22 +0000 (+0100) Subject: docs: wip document shapelibs, move from shapelib-toml X-Git-Tag: otter-0.6.0~34 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=086cd4e5d7663e6d186f1bac8e37ec7360d3db14;p=otter.git docs: wip document shapelibs, move from shapelib-toml Signed-off-by: Ian Jackson --- diff --git a/docs/shapelibs.rst b/docs/shapelibs.rst index 3d4a9f50..8c29a91d 100644 --- a/docs/shapelibs.rst +++ b/docs/shapelibs.rst @@ -179,16 +179,6 @@ Parameters ``_s`` is replaced by the sort extra field from the ``files`` list ``_c`` is replaced by the colour, if applicable. - * ``orig_size`` [1- or 2-element array, or (default) empty array]: If - non-empty, the supplied image is first scaled from ``orig_size`` - to ``size``. If both ``size`` and ```orig_size`` are 2 elements, - this can scale by different amounts in x and y, distorting the - image. - - * ``centre`` [2-element array]. The centre of the image, measured - from the top left in the image's own internal units. If not - supplied, calculated from the size. - * ``flip`` [boolean, default: false]. Whether this piece can "flip". If true, the piece will have two faces, one of which is a mirror image of the other. The default face will be un-reflected version; @@ -203,3 +193,18 @@ Parameters ``files`` entry, and a 2nd face looking like ``back``. If you want to make the piece be occultable, you must also specify ``occulted``. ``back`` is not compatible with ``flip``. + + * ``orig_size`` [1- or 2-element array, or (default) empty array]: If + non-empty, the supplied image is first scaled from ``orig_size`` + to ``size``. If both ``size`` and ```orig_size`` are 2 elements, + this can scale by different amounts in x and y, distorting the + image. + + * ``centre`` [2-element array]. The centre of the image, measured + from the top left in the image's own internal units. If not + supplied, calculated from the size. + + * ``scale``: [number, default=1]. Scale the image by a factor (in + both x and y). ``size`` and ``centre`` are in the image file's + own internal coordinate system, not the Otter scaled coordinates + which result from multiplying by by this scale factor. diff --git a/src/shapelib-toml.rs b/src/shapelib-toml.rs index 3759e972..9641625f 100644 --- a/src/shapelib-toml.rs +++ b/src/shapelib-toml.rs @@ -26,13 +26,7 @@ pub struct GroupDetails { #[serde(default)] pub centre: Option<[f64; 2]>, #[serde(default)] pub flip: bool, #[serde(default)] pub back: Option>, - - /// `size` and `centre` are in the SVG's own internal coordinate - /// system, not the Otter scaled coordinates which result from - /// multiplying by by this scale factor. - /// If not specified, default is `1.0`. - #[serde(default="num_traits::identities::One::one")] - pub scale: f64, + #[serde(default="num_traits::identities::One::one")] pub scale: f64, /// If specified and non-empty, specifies that this group should be /// instantiated multiple times, each time with a recolouring.