Move olx.style.TextOptions to ol/style/Text
This commit is contained in:
@@ -14,12 +14,43 @@ import TextPlacement from '../style/TextPlacement.js';
|
||||
const DEFAULT_FILL_COLOR = '#333';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [font] Font style as CSS 'font' value, see:
|
||||
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font}. Default is '10px sans-serif'
|
||||
* @property {number} [maxAngle] 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`).
|
||||
* @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.
|
||||
* @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.
|
||||
* @property {boolean} [overflow=false] 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.
|
||||
* @property {module:ol/style/Text~TextPlacement|string} [placement] Text placement.
|
||||
* @property {number} [scale] Scale.
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
|
||||
* @property {number} rotation=0 Rotation in radians (positive rotation clockwise).
|
||||
* @property {string} [text] Text content.
|
||||
* @property {string} [textAlign] 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.
|
||||
* @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
* @property {module:ol/style/Fill~Fill} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
* @property {module:ol/style/Stroke~Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Fill~Fill} [backgroundFill] Fill style for the text background when `placement` is
|
||||
* `'point'`. Default is no fill.
|
||||
* @property {module:ol/style/Stroke~Stroke} [backgroundStroke] Stroke style for the text background when `placement`
|
||||
* is `'point'`. Default is no stroke.
|
||||
* @property {Array.<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
|
||||
* values in the array is `[top, right, bottom, left]`.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Set text style for vector features.
|
||||
*
|
||||
* @constructor
|
||||
* @param {olx.style.TextOptions=} opt_options Options.
|
||||
* @param {module:ol/style/Text~Options=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
const Text = function(opt_options) {
|
||||
|
||||
Reference in New Issue
Block a user