Use CanvasLineJoin type instead of string

This commit is contained in:
Frederic Junod
2019-07-05 11:07:10 +02:00
parent 5cff84522a
commit 7a8a0c18ae
5 changed files with 14 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ import LabelCache from './canvas/LabelCache.js';
* @property {string} [currentLineCap]
* @property {Array<number>} currentLineDash
* @property {number} [currentLineDashOffset]
* @property {string} [currentLineJoin]
* @property {CanvasLineJoin} [currentLineJoin]
* @property {number} [currentLineWidth]
* @property {number} [currentMiterLimit]
* @property {number} [lastStroke]
@@ -30,7 +30,7 @@ import LabelCache from './canvas/LabelCache.js';
* @property {string} [lineCap]
* @property {Array<number>} lineDash
* @property {number} [lineDashOffset]
* @property {string} [lineJoin]
* @property {CanvasLineJoin} [lineJoin]
* @property {number} [lineWidth]
* @property {number} [miterLimit]
*/
@@ -41,7 +41,7 @@ import LabelCache from './canvas/LabelCache.js';
* @property {string} lineCap
* @property {Array<number>} lineDash
* @property {number} lineDashOffset
* @property {string} lineJoin
* @property {CanvasLineJoin} lineJoin
* @property {number} lineWidth
* @property {number} miterLimit
* @property {import("../colorlike.js").ColorLike} strokeStyle
@@ -113,7 +113,7 @@ export const defaultLineDashOffset = 0;
/**
* @const
* @type {string}
* @type {CanvasLineJoin}
*/
export const defaultLineJoin = 'round';

View File

@@ -208,7 +208,7 @@ class Executor extends Disposable {
context.strokeStyle = strokeState.strokeStyle;
context.lineWidth = strokeWidth;
context.lineCap = /** @type {CanvasLineCap} */ (strokeState.lineCap);
context.lineJoin = /** @type {CanvasLineJoin} */ (strokeState.lineJoin);
context.lineJoin = strokeState.lineJoin;
context.miterLimit = strokeState.miterLimit;
if (context.setLineDash && strokeState.lineDash.length) {
context.setLineDash(strokeState.lineDash);

View File

@@ -697,7 +697,7 @@ class CanvasImmediateRenderer extends VectorContext {
context.setLineDash(strokeState.lineDash);
context.lineDashOffset = strokeState.lineDashOffset;
}
context.lineJoin = /** @type {CanvasLineJoin} */ (strokeState.lineJoin);
context.lineJoin = strokeState.lineJoin;
context.lineWidth = strokeState.lineWidth;
context.miterLimit = strokeState.miterLimit;
context.strokeStyle = strokeState.strokeStyle;
@@ -724,7 +724,7 @@ class CanvasImmediateRenderer extends VectorContext {
}
}
if (contextStrokeState.lineJoin != strokeState.lineJoin) {
contextStrokeState.lineJoin = context.lineJoin = /** @type {CanvasLineJoin} */ (strokeState.lineJoin);
contextStrokeState.lineJoin = context.lineJoin = strokeState.lineJoin;
}
if (contextStrokeState.lineWidth != strokeState.lineWidth) {
contextStrokeState.lineWidth = context.lineWidth = strokeState.lineWidth;