More efficient default fill color
This commit is contained in:
@@ -85,9 +85,9 @@ export const defaultFont = '10px sans-serif';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {import("../color.js").Color}
|
* @type {import("../colorlike.js").ColorLike}
|
||||||
*/
|
*/
|
||||||
export const defaultFillStyle = [0, 0, 0, 1];
|
export const defaultFillStyle = '#000';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/render/canvas/PolygonBuilder
|
* @module ol/render/canvas/PolygonBuilder
|
||||||
*/
|
*/
|
||||||
import {asString} from '../../color.js';
|
|
||||||
import {snap} from '../../geom/flat/simplify.js';
|
import {snap} from '../../geom/flat/simplify.js';
|
||||||
import {defaultFillStyle} from '../canvas.js';
|
import {defaultFillStyle} from '../canvas.js';
|
||||||
import CanvasInstruction, {
|
import CanvasInstruction, {
|
||||||
@@ -77,7 +76,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|||||||
if (state.fillStyle !== undefined) {
|
if (state.fillStyle !== undefined) {
|
||||||
this.hitDetectionInstructions.push([
|
this.hitDetectionInstructions.push([
|
||||||
CanvasInstruction.SET_FILL_STYLE,
|
CanvasInstruction.SET_FILL_STYLE,
|
||||||
asString(defaultFillStyle)
|
defaultFillStyle
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (state.strokeStyle !== undefined) {
|
if (state.strokeStyle !== undefined) {
|
||||||
@@ -121,7 +120,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|||||||
if (state.fillStyle !== undefined) {
|
if (state.fillStyle !== undefined) {
|
||||||
this.hitDetectionInstructions.push([
|
this.hitDetectionInstructions.push([
|
||||||
CanvasInstruction.SET_FILL_STYLE,
|
CanvasInstruction.SET_FILL_STYLE,
|
||||||
asString(defaultFillStyle)
|
defaultFillStyle
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (state.strokeStyle !== undefined) {
|
if (state.strokeStyle !== undefined) {
|
||||||
@@ -153,7 +152,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|||||||
if (state.fillStyle !== undefined) {
|
if (state.fillStyle !== undefined) {
|
||||||
this.hitDetectionInstructions.push([
|
this.hitDetectionInstructions.push([
|
||||||
CanvasInstruction.SET_FILL_STYLE,
|
CanvasInstruction.SET_FILL_STYLE,
|
||||||
asString(defaultFillStyle)
|
defaultFillStyle
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (state.strokeStyle !== undefined) {
|
if (state.strokeStyle !== undefined) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* @module ol/style/RegularShape
|
* @module ol/style/RegularShape
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {asString} from '../color.js';
|
|
||||||
import {asColorLike} from '../colorlike.js';
|
import {asColorLike} from '../colorlike.js';
|
||||||
import {createCanvasContext2D} from '../dom.js';
|
import {createCanvasContext2D} from '../dom.js';
|
||||||
import ImageState from '../ImageState.js';
|
import ImageState from '../ImageState.js';
|
||||||
@@ -482,7 +481,7 @@ class RegularShape extends ImageStyle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.fillStyle = asString(defaultFillStyle);
|
context.fillStyle = defaultFillStyle;
|
||||||
context.fill();
|
context.fill();
|
||||||
if (this.stroke_) {
|
if (this.stroke_) {
|
||||||
context.strokeStyle = renderOptions.strokeStyle;
|
context.strokeStyle = renderOptions.strokeStyle;
|
||||||
|
|||||||
Reference in New Issue
Block a user