Move ol.CanvasStrokeState to ol/render/canvas

This commit is contained in:
Michael Kuenzli
2018-04-18 14:37:06 +02:00
parent 113785f048
commit 6096f84be2
4 changed files with 20 additions and 20 deletions

View File

@@ -35,6 +35,18 @@ import {create as createTransform} from '../transform.js';
*/
/**
* @typedef {Object} StrokeState
* @property {string} lineCap
* @property {Array.<number>} lineDash
* @property {number} lineDashOffset
* @property {string} lineJoin
* @property {number} lineWidth
* @property {number} miterLimit
* @property {module:ol/colorlike~ColorLike} strokeStyle
*/
/**
* @const
* @type {string}

View File

@@ -76,7 +76,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {?ol.CanvasStrokeState}
* @type {?module:ol/render/canvas~StrokeState}
*/
this.contextStrokeState_ = null;
@@ -94,7 +94,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {?ol.CanvasStrokeState}
* @type {?module:ol/render/canvas~StrokeState}
*/
this.strokeState_ = null;
@@ -214,7 +214,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/**
* @private
* @type {?ol.CanvasStrokeState}
* @type {?module:ol/render/canvas~StrokeState}
*/
this.textStrokeState_ = null;
@@ -718,7 +718,7 @@ CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) {
/**
* @param {ol.CanvasStrokeState} strokeState Stroke state.
* @param {module:ol/render/canvas~StrokeState} strokeState Stroke state.
* @private
*/
CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) {

View File

@@ -85,12 +85,12 @@ const CanvasTextReplay = function(
/**
* @private
* @type {?ol.CanvasStrokeState}
* @type {?module:ol/render/canvas~StrokeState}
*/
this.textStrokeState_ = null;
/**
* @type {!Object.<string, ol.CanvasStrokeState>}
* @type {!Object.<string, module:ol/render/canvas~StrokeState>}
*/
this.strokeStates = {};
@@ -391,7 +391,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
const strokeKey = this.strokeKey_;
if (strokeState) {
if (!(strokeKey in this.strokeStates)) {
this.strokeStates[strokeKey] = /** @type {ol.CanvasStrokeState} */ ({
this.strokeStates[strokeKey] = /** @type {module:ol/render/canvas~StrokeState} */ ({
strokeStyle: strokeState.strokeStyle,
lineCap: strokeState.lineCap,
lineDashOffset: strokeState.lineDashOffset,
@@ -486,7 +486,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
} else {
strokeState = this.textStrokeState_;
if (!strokeState) {
strokeState = this.textStrokeState_ = /** @type {ol.CanvasStrokeState} */ ({});
strokeState = this.textStrokeState_ = /** @type {module:ol/render/canvas~StrokeState} */ ({});
}
const lineDash = textStrokeStyle.getLineDash();
const lineDashOffset = textStrokeStyle.getLineDashOffset();

View File

@@ -21,18 +21,6 @@ const ol = {};
*/
/**
* @typedef {{lineCap: string,
* lineDash: Array.<number>,
* lineDashOffset: number,
* lineJoin: string,
* lineWidth: number,
* miterLimit: number,
* strokeStyle: module:ol/colorlike~ColorLike}}
*/
ol.CanvasStrokeState;
/**
* @typedef {{font: string,
* textAlign: (string|undefined),