Move ol.CanvasStrokeState to ol/render/canvas
This commit is contained in:
@@ -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
|
* @const
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.CanvasStrokeState}
|
* @type {?module:ol/render/canvas~StrokeState}
|
||||||
*/
|
*/
|
||||||
this.contextStrokeState_ = null;
|
this.contextStrokeState_ = null;
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.CanvasStrokeState}
|
* @type {?module:ol/render/canvas~StrokeState}
|
||||||
*/
|
*/
|
||||||
this.strokeState_ = null;
|
this.strokeState_ = null;
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.CanvasStrokeState}
|
* @type {?module:ol/render/canvas~StrokeState}
|
||||||
*/
|
*/
|
||||||
this.textStrokeState_ = null;
|
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
|
* @private
|
||||||
*/
|
*/
|
||||||
CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) {
|
CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) {
|
||||||
|
|||||||
@@ -85,12 +85,12 @@ const CanvasTextReplay = function(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.CanvasStrokeState}
|
* @type {?module:ol/render/canvas~StrokeState}
|
||||||
*/
|
*/
|
||||||
this.textStrokeState_ = null;
|
this.textStrokeState_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {!Object.<string, ol.CanvasStrokeState>}
|
* @type {!Object.<string, module:ol/render/canvas~StrokeState>}
|
||||||
*/
|
*/
|
||||||
this.strokeStates = {};
|
this.strokeStates = {};
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
|
|||||||
const strokeKey = this.strokeKey_;
|
const strokeKey = this.strokeKey_;
|
||||||
if (strokeState) {
|
if (strokeState) {
|
||||||
if (!(strokeKey in this.strokeStates)) {
|
if (!(strokeKey in this.strokeStates)) {
|
||||||
this.strokeStates[strokeKey] = /** @type {ol.CanvasStrokeState} */ ({
|
this.strokeStates[strokeKey] = /** @type {module:ol/render/canvas~StrokeState} */ ({
|
||||||
strokeStyle: strokeState.strokeStyle,
|
strokeStyle: strokeState.strokeStyle,
|
||||||
lineCap: strokeState.lineCap,
|
lineCap: strokeState.lineCap,
|
||||||
lineDashOffset: strokeState.lineDashOffset,
|
lineDashOffset: strokeState.lineDashOffset,
|
||||||
@@ -486,7 +486,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
|
|||||||
} else {
|
} else {
|
||||||
strokeState = this.textStrokeState_;
|
strokeState = this.textStrokeState_;
|
||||||
if (!strokeState) {
|
if (!strokeState) {
|
||||||
strokeState = this.textStrokeState_ = /** @type {ol.CanvasStrokeState} */ ({});
|
strokeState = this.textStrokeState_ = /** @type {module:ol/render/canvas~StrokeState} */ ({});
|
||||||
}
|
}
|
||||||
const lineDash = textStrokeStyle.getLineDash();
|
const lineDash = textStrokeStyle.getLineDash();
|
||||||
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
||||||
|
|||||||
@@ -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,
|
* @typedef {{font: string,
|
||||||
* textAlign: (string|undefined),
|
* textAlign: (string|undefined),
|
||||||
|
|||||||
Reference in New Issue
Block a user