Merge pull request #14006 from mike-000/displacement

Improve description of displacement in docs
This commit is contained in:
Tim Schaub
2022-08-18 07:36:56 -06:00
committed by GitHub
2 changed files with 15 additions and 13 deletions

View File

@@ -38,21 +38,22 @@ import {getUid} from '../util.js';
* @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the * @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
* provided image must already be loaded. And in that case, it is required * provided image must already be loaded. And in that case, it is required
* to provide the size of the image, with the `imgSize` option. * to provide the size of the image, with the `imgSize` option.
* @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the * @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not.
* sub-rectangle to use from the original icon image. * The provided `imgSize` needs to match the actual size of the image.
* @property {Array<number>} [displacement=[0,0]] Displacement of the icon. * @property {Array<number>} [displacement=[0, 0]] Displacement of the icon in pixels.
* @property {IconOrigin} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`, * Positive values will shift the icon right and up.
* `top-left` or `top-right`.
* @property {number} [opacity=1] Opacity of the icon. * @property {number} [opacity=1] Opacity of the icon.
* @property {number|import("../size.js").Size} [scale=1] Scale. * @property {number|import("../size.js").Size} [scale=1] Scale.
* @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view. * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
* @property {import("../size.js").Size} [size] Icon size in pixel. Can be used together with `offset` to define the * @property {Array<number>} [offset=[0, 0]] Offset which, together with `size` and `offsetOrigin`, defines the
* sub-rectangle to use from the origin (sprite) icon image. * sub-rectangle to use from the original (sprite) image.
* @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not. * @property {IconOrigin} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
* The provided `imgSize` needs to match the actual size of the image. * `top-left` or `top-right`.
* @property {import("../size.js").Size} [size] Icon size in pixels. Used together with `offset` to define the
* sub-rectangle to use from the original (sprite) image.
* @property {string} [src] Image source URI. * @property {string} [src] Image source URI.
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode.
*/ */
/** /**

View File

@@ -24,14 +24,15 @@ import {
* @property {number} [radius] Radius of a regular polygon. * @property {number} [radius] Radius of a regular polygon.
* @property {number} [radius1] First radius of a star. Ignored if radius is set. * @property {number} [radius1] First radius of a star. Ignored if radius is set.
* @property {number} [radius2] Second radius of a star. * @property {number} [radius2] Second radius of a star.
* @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up. * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's points facing up.
* @property {Array<number>} [displacement=[0,0]] Displacement of the shape * @property {Array<number>} [displacement=[0, 0]] Displacement of the shape in pixels.
* Positive values will shift the shape right and up.
* @property {import("./Stroke.js").default} [stroke] Stroke style. * @property {import("./Stroke.js").default} [stroke] Stroke style.
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise). * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
* @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view. * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.
* @property {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better * @property {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better
* result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`. * result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`.
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode * @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode.
*/ */
/** /**