Skip to content

Documentation / @geoverse/core-ol / SetTextOptions

Interface: SetTextOptions

Defined in: packages/core-ol/src/features/feature.ts:40

Extends

  • Options

Properties

backColor?

ts
optional backColor?: string;

Defined in: packages/core-ol/src/features/feature.ts:52


backgroundFill?

ts
optional backgroundFill?: Fill;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:97

Fill style for the text background when placement is 'point'. Default is no fill.

Inherited from

ts
TextOptions.backgroundFill

backgroundStroke?

ts
optional backgroundStroke?: Stroke;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:102

Stroke style for the text background when placement is 'point'. Default is no stroke.

Inherited from

ts
TextOptions.backgroundStroke

color?

ts
optional color?: string;

Defined in: packages/core-ol/src/features/feature.ts:51


declutterMode?

ts
optional declutterMode?: DeclutterMode;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:111

Declutter mode: declutter, obstacle, none

Inherited from

ts
TextOptions.declutterMode

fill?

ts
optional fill?: Fill | null;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:88

Fill style. If none is provided, we'll use a dark fill-style (#333). Specify null for no fill.

Inherited from

ts
TextOptions.fill

font?

ts
optional font?: string;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:15

Font style as CSS font value, see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'

Inherited from

ts
TextOptions.font

hasBack?

ts
optional hasBack?: boolean;

Defined in: packages/core-ol/src/features/feature.ts:48

是否带背景,默认 false


isBolder?

ts
optional isBolder?: boolean;

Defined in: packages/core-ol/src/features/feature.ts:42

加粗,默认 false


justify?

ts
optional justify?: TextJustify;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:79

Text justification within the text box. If not set, text is justified towards the textAlign anchor. Otherwise, use options 'left', 'center', or 'right' to justify the text within the text box. Note: justify is ignored for immediate rendering and also for placement: 'line'.

Inherited from

ts
TextOptions.justify

keepUpright?

ts
optional keepUpright?: boolean;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:54

Whether the text can be rotated 180° to prevent being rendered upside down.

Inherited from

ts
TextOptions.keepUpright

maxAngle?

ts
optional maxAngle?: number;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:20

When placement is set to 'line', allow a maximum angle between adjacent characters. The expected value is in radians, and the default is 45° (Math.PI / 4).

Inherited from

ts
TextOptions.maxAngle

offset?

ts
optional offset?: number[];

Defined in: packages/core-ol/src/features/feature.ts:46

偏移 [x, y]


offsetX?

ts
optional offsetX?: number;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:24

Horizontal text offset in pixels. A positive will shift the text right.

Inherited from

ts
TextOptions.offsetX

offsetY?

ts
optional offsetY?: number;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:28

Vertical text offset in pixels. A positive will shift the text down.

Inherited from

ts
TextOptions.offsetY

overflow?

ts
optional overflow?: boolean;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:33

For polygon labels or when placement is set to 'line', allow text to exceed the width of the polygon at the label position or the length of the path that it follows.

Inherited from

ts
TextOptions.overflow

padding?

ts
optional padding?: number[];

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:107

Padding in pixels around the text for decluttering and background. The order of values in the array is [top, right, bottom, left].

Inherited from

ts
TextOptions.padding

placement?

ts
optional placement?: TextPlacement;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:37

Text placement.

Inherited from

ts
TextOptions.placement

repeat?

ts
optional repeat?: number;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:42

Repeat interval. When set, the text will be repeated at this interval, which specifies the distance between two text anchors in pixels. Only available when placement is set to 'line'. Overrides 'textAlign'.

Inherited from

ts
TextOptions.repeat

rotateWithView?

ts
optional rotateWithView?: boolean;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:50

Whether to rotate the text with the view.

Inherited from

ts
TextOptions.rotateWithView

rotation?

ts
optional rotation?: number;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:58

Rotation in radians (positive rotation clockwise).

Inherited from

ts
TextOptions.rotation

scale?

ts
optional scale?: number | Size;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:46

Scale.

Inherited from

ts
TextOptions.scale

size?

ts
optional size?: number;

Defined in: packages/core-ol/src/features/feature.ts:44

字号,默认 13


stroke?

ts
optional stroke?: Stroke;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:92

Stroke style.

Inherited from

ts
TextOptions.stroke

strokeColor?

ts
optional strokeColor?: string;

Defined in: packages/core-ol/src/features/feature.ts:49


strokeWidth?

ts
optional strokeWidth?: number;

Defined in: packages/core-ol/src/features/feature.ts:50


text?

ts
optional text?: string | string[];

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:66

Text content or rich text content. For plain text provide a string, which can contain line breaks (\n). For rich text provide an array of text/font tuples. A tuple consists of the text to render and the font to use (or '' to use the text style's font). A line break has to be a separate tuple (i.e. '\n', ''). Example: ['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', ''] will yield "foo bar baz". Note: Rich text is not supported for placement: 'line' or the immediate rendering API.

Inherited from

ts
TextOptions.text

textAlign?

ts
optional textAlign?: CanvasTextAlign;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:72

Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'. Default is 'center' for placement: 'point'. For placement: 'line', the default is to let the renderer choose a placement where maxAngle is not exceeded.

Inherited from

ts
TextOptions.textAlign

textBaseline?

ts
optional textBaseline?: CanvasTextBaseline;

Defined in: node_modules/.pnpm/ol@10.9.0/node_modules/ol/style/Text.d.ts:84

Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic', 'hanging', 'ideographic'.

Inherited from

ts
TextOptions.textBaseline