Anchor type
One of the 9 points of a box: its corners, the middles of its sides, its center.
ts
import type { Anchor } from 'utils';Signature
ts
export type Anchor =
'bottom' | 'bottom-left' | 'bottom-right' | 'center' | 'left' | 'right' | 'top' | 'top-left' | 'top-right';Tests
Line coverage: 0 %.
Source
src/svg-transform/anchor.ts (on GitHub)
Used by
getSvgAnchorPoint: Finds an anchor of the box an SVG element takes on screen: a corner, the middle of a side or the center.getSvgAnchorPointIn: Finds an anchor of an element as seen on screen, in the coordinates of another element, whatever groups lie between: the center of a hub for thesetRotateof a needle drawn in another group.svgFlipTo: An order ofapplySvgTransformsthat makes the element mirrored or not, as seen on screen, around one of its anchors:svgFlipTo(false)makes a mirrored text readable again.svgPlaceOn: An order ofapplySvgTransformsthat moves the element so that one of its anchors lands on an anchor of another element, as seen on screen, whatever groups each one is in.svgRotateBy: An order ofapplySvgTransformsthat turns the element by an angle from its position before this order, clockwise on screen, around an anchor of itself or of another element:set(90)afterset(3)gives 90° from the start, not 93°.svgRotateTo: An order ofapplySvgTransformsthat turns the element to an absolute angle on screen, clockwise from upright, around an anchor of itself or of another element:svgRotateTo(0)straightens it.svgScaleBy: An order ofapplySvgTransformsthat enlarges or shrinks the element in its own axes, around an anchor of its drawing, which gives the direction: with'left', it grows to the right; with'bottom', upwards.
Source code
ts
/** One of the 9 points of a box: its corners, the middles of its sides, its center. */
export type Anchor =
'bottom' | 'bottom-left' | 'bottom-right' | 'center' | 'left' | 'right' | 'top' | 'top-left' | 'top-right';Keywords: anchor, svg transforms, type