Move ol.CanvasTextState to ol/render/canvas

This commit is contained in:
Michael Kuenzli
2018-04-18 14:40:54 +02:00
parent 6096f84be2
commit b740630e89
4 changed files with 15 additions and 15 deletions

View File

@@ -47,6 +47,14 @@ import {create as createTransform} from '../transform.js';
*/
/**
* @typedef {Object} TextState
* @property {string} font
* @property {string} [textAlign]
* @property {string} textBaseline
*/
/**
* @const
* @type {string}

View File

@@ -82,7 +82,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {?ol.CanvasTextState}
* @type {?module:ol/render/canvas~TextState}
*/
this.contextTextState_ = null;
@@ -220,7 +220,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {?ol.CanvasTextState}
* @type {?module:ol/render/canvas~TextState}
*/
this.textState_ = null;
@@ -775,7 +775,7 @@ CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState)
/**
* @param {ol.CanvasTextState} textState Text state.
* @param {module:ol/render/canvas~TextState} textState Text state.
* @private
*/
CanvasImmediateRenderer.prototype.setContextTextState_ = function(textState) {

View File

@@ -96,12 +96,12 @@ const CanvasTextReplay = function(
/**
* @private
* @type {ol.CanvasTextState}
* @type {module:ol/render/canvas~TextState}
*/
this.textState_ = /** @type {ol.CanvasTextState} */ ({});
this.textState_ = /** @type {module:ol/render/canvas~TextState} */ ({});
/**
* @type {!Object.<string, ol.CanvasTextState>}
* @type {!Object.<string, module:ol/render/canvas~TextState>}
*/
this.textStates = {};
@@ -404,7 +404,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
}
const textKey = this.textKey_;
if (!(this.textKey_ in this.textStates)) {
this.textStates[this.textKey_] = /** @type {ol.CanvasTextState} */ ({
this.textStates[this.textKey_] = /** @type {module:ol/render/canvas~TextState} */ ({
font: textState.font,
textAlign: textState.textAlign || defaultTextAlign,
scale: textState.scale

View File

@@ -21,14 +21,6 @@ const ol = {};
*/
/**
* @typedef {{font: string,
* textAlign: (string|undefined),
* textBaseline: string}}
*/
ol.CanvasTextState;
/**
* Container for decluttered replay instructions that need to be rendered or
* omitted together, i.e. when styles render both an image and text, or for the