Use CanvasLineCap type instead of string
This commit is contained in:
@@ -18,7 +18,7 @@ import LabelCache from './canvas/LabelCache.js';
|
||||
* @typedef {Object} FillStrokeState
|
||||
* @property {import("../colorlike.js").ColorLike} [currentFillStyle]
|
||||
* @property {import("../colorlike.js").ColorLike} [currentStrokeStyle]
|
||||
* @property {string} [currentLineCap]
|
||||
* @property {CanvasLineCap} [currentLineCap]
|
||||
* @property {Array<number>} currentLineDash
|
||||
* @property {number} [currentLineDashOffset]
|
||||
* @property {CanvasLineJoin} [currentLineJoin]
|
||||
@@ -27,7 +27,7 @@ import LabelCache from './canvas/LabelCache.js';
|
||||
* @property {number} [lastStroke]
|
||||
* @property {import("../colorlike.js").ColorLike} [fillStyle]
|
||||
* @property {import("../colorlike.js").ColorLike} [strokeStyle]
|
||||
* @property {string} [lineCap]
|
||||
* @property {CanvasLineCap} [lineCap]
|
||||
* @property {Array<number>} lineDash
|
||||
* @property {number} [lineDashOffset]
|
||||
* @property {CanvasLineJoin} [lineJoin]
|
||||
@@ -38,7 +38,7 @@ import LabelCache from './canvas/LabelCache.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} StrokeState
|
||||
* @property {string} lineCap
|
||||
* @property {CanvasLineCap} lineCap
|
||||
* @property {Array<number>} lineDash
|
||||
* @property {number} lineDashOffset
|
||||
* @property {CanvasLineJoin} lineJoin
|
||||
@@ -92,7 +92,7 @@ export const defaultFillStyle = '#000';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
* @type {CanvasLineCap}
|
||||
*/
|
||||
export const defaultLineCap = 'round';
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ class Executor extends Disposable {
|
||||
if (strokeKey) {
|
||||
context.strokeStyle = strokeState.strokeStyle;
|
||||
context.lineWidth = strokeWidth;
|
||||
context.lineCap = /** @type {CanvasLineCap} */ (strokeState.lineCap);
|
||||
context.lineCap = strokeState.lineCap;
|
||||
context.lineJoin = strokeState.lineJoin;
|
||||
context.miterLimit = strokeState.miterLimit;
|
||||
if (context.setLineDash && strokeState.lineDash.length) {
|
||||
|
||||
@@ -692,7 +692,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
const context = this.context_;
|
||||
const contextStrokeState = this.contextStrokeState_;
|
||||
if (!contextStrokeState) {
|
||||
context.lineCap = /** @type {CanvasLineCap} */ (strokeState.lineCap);
|
||||
context.lineCap = strokeState.lineCap;
|
||||
if (context.setLineDash) {
|
||||
context.setLineDash(strokeState.lineDash);
|
||||
context.lineDashOffset = strokeState.lineDashOffset;
|
||||
@@ -712,7 +712,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
};
|
||||
} else {
|
||||
if (contextStrokeState.lineCap != strokeState.lineCap) {
|
||||
contextStrokeState.lineCap = context.lineCap = /** @type {CanvasLineCap} */ (strokeState.lineCap);
|
||||
contextStrokeState.lineCap = context.lineCap = strokeState.lineCap;
|
||||
}
|
||||
if (context.setLineDash) {
|
||||
if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {
|
||||
|
||||
Reference in New Issue
Block a user