Move ol.CanvasFillState to ol/render/canvas

This commit is contained in:
Michael Kuenzli
2018-04-18 10:46:47 +02:00
parent 5e810ccc6a
commit 4f74bcaa31
4 changed files with 13 additions and 14 deletions

View File

@@ -8,6 +8,11 @@ import LRUCache from '../structs/LRUCache.js';
import {create as createTransform} from '../transform.js'; import {create as createTransform} from '../transform.js';
/**
* @typedef {{fillStyle: module:ol/colorlike~ColorLike}} FillState
*/
/** /**
* @const * @const
* @type {string} * @type {string}

View File

@@ -70,7 +70,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/** /**
* @private * @private
* @type {?ol.CanvasFillState} * @type {?module:ol/render/canvas~FillState}
*/ */
this.contextFillState_ = null; this.contextFillState_ = null;
@@ -88,7 +88,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/** /**
* @private * @private
* @type {?ol.CanvasFillState} * @type {?module:ol/render/canvas~FillState}
*/ */
this.fillState_ = null; this.fillState_ = null;
@@ -208,7 +208,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
/** /**
* @private * @private
* @type {?ol.CanvasFillState} * @type {?module:ol/render/canvas~FillState}
*/ */
this.textFillState_ = null; this.textFillState_ = null;
@@ -698,7 +698,7 @@ CanvasImmediateRenderer.prototype.drawMultiPolygon = function(geometry) {
/** /**
* @param {ol.CanvasFillState} fillState Fill state. * @param {module:ol/render/canvas~FillState} fillState Fill state.
* @private * @private
*/ */
CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) { CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) {

View File

@@ -74,12 +74,12 @@ const CanvasTextReplay = function(
/** /**
* @private * @private
* @type {?ol.CanvasFillState} * @type {?module:ol/render/canvas~FillState}
*/ */
this.textFillState_ = null; this.textFillState_ = null;
/** /**
* @type {!Object.<string, ol.CanvasFillState>} * @type {!Object.<string, module:ol/render/canvas~FillState>}
*/ */
this.fillStates = {}; this.fillStates = {};
@@ -413,7 +413,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
const fillKey = this.fillKey_; const fillKey = this.fillKey_;
if (fillState) { if (fillState) {
if (!(fillKey in this.fillStates)) { if (!(fillKey in this.fillStates)) {
this.fillStates[fillKey] = /** @type {ol.CanvasFillState} */ ({ this.fillStates[fillKey] = /** @type {module:ol/render/canvas~FillState} */ ({
fillStyle: fillState.fillStyle fillStyle: fillState.fillStyle
}); });
} }
@@ -474,7 +474,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
} else { } else {
fillState = this.textFillState_; fillState = this.textFillState_;
if (!fillState) { if (!fillState) {
fillState = this.textFillState_ = /** @type {ol.CanvasFillState} */ ({}); fillState = this.textFillState_ = /** @type {module:ol/render/canvas~FillState} */ ({});
} }
fillState.fillStyle = asColorLike( fillState.fillStyle = asColorLike(
textFillStyle.getColor() || defaultFillStyle); textFillStyle.getColor() || defaultFillStyle);

View File

@@ -21,12 +21,6 @@ const ol = {};
*/ */
/**
* @typedef {{fillStyle: module:ol/colorlike~ColorLike}}
*/
ol.CanvasFillState;
/** /**
* A function returning the canvas element (`{HTMLCanvasElement}`) * A function returning the canvas element (`{HTMLCanvasElement}`)
* used by the source as an image. The arguments passed to the function are: * used by the source as an image. The arguments passed to the function are: