Remove unused 'geometry' param from 'createFill' function

This commit is contained in:
Frederic Junod
2019-02-22 16:52:32 +01:00
parent 79c6cc5159
commit cd28c8a301
3 changed files with 11 additions and 14 deletions

View File

@@ -352,10 +352,9 @@ class CanvasBuilder extends VectorContext {
/** /**
* @param {import("../canvas.js").FillStrokeState} state State. * @param {import("../canvas.js").FillStrokeState} state State.
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
* @return {Array<*>} Fill instruction. * @return {Array<*>} Fill instruction.
*/ */
createFill(state, geometry) { createFill(state) {
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
/** @type {Array<*>} */ /** @type {Array<*>} */
const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle]; const fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];
@@ -388,14 +387,13 @@ class CanvasBuilder extends VectorContext {
/** /**
* @param {import("../canvas.js").FillStrokeState} state State. * @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState, (import("../../geom/Geometry.js").default|import("../Feature.js").default)):Array<*>} createFill Create fill. * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
*/ */
updateFillStyle(state, createFill, geometry) { updateFillStyle(state, createFill) {
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) { if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
if (fillStyle !== undefined) { if (fillStyle !== undefined) {
this.instructions.push(createFill.call(this, state, geometry)); this.instructions.push(createFill.call(this, state));
} }
state.currentFillStyle = fillStyle; state.currentFillStyle = fillStyle;
} }

View File

@@ -72,7 +72,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
if (fillStyle === undefined && strokeStyle === undefined) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
this.setFillStrokeStyles_(circleGeometry); this.setFillStrokeStyles_();
this.beginGeometry(feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
@@ -116,7 +116,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
if (fillStyle === undefined && strokeStyle === undefined) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
this.setFillStrokeStyles_(polygonGeometry); this.setFillStrokeStyles_();
this.beginGeometry(feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
@@ -148,7 +148,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
if (fillStyle === undefined && strokeStyle === undefined) { if (fillStyle === undefined && strokeStyle === undefined) {
return; return;
} }
this.setFillStrokeStyles_(multiPolygonGeometry); this.setFillStrokeStyles_();
this.beginGeometry(feature); this.beginGeometry(feature);
if (state.fillStyle !== undefined) { if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
@@ -195,13 +195,12 @@ class CanvasPolygonBuilder extends CanvasBuilder {
/** /**
* @private * @private
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
*/ */
setFillStrokeStyles_(geometry) { setFillStrokeStyles_() {
const state = this.state; const state = this.state;
const fillStyle = state.fillStyle; const fillStyle = state.fillStyle;
if (fillStyle !== undefined) { if (fillStyle !== undefined) {
this.updateFillStyle(state, this.createFill, geometry); this.updateFillStyle(state, this.createFill);
} }
if (state.strokeStyle !== undefined) { if (state.strokeStyle !== undefined) {
this.updateStrokeStyle(state, this.applyStroke); this.updateStrokeStyle(state, this.applyStroke);

View File

@@ -258,8 +258,8 @@ class CanvasTextBuilder extends CanvasBuilder {
if (textState.backgroundFill || textState.backgroundStroke) { if (textState.backgroundFill || textState.backgroundStroke) {
this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke); this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke);
if (textState.backgroundFill) { if (textState.backgroundFill) {
this.updateFillStyle(this.state, this.createFill, geometry); this.updateFillStyle(this.state, this.createFill);
this.hitDetectionInstructions.push(this.createFill(this.state, geometry)); this.hitDetectionInstructions.push(this.createFill(this.state));
} }
if (textState.backgroundStroke) { if (textState.backgroundStroke) {
this.updateStrokeStyle(this.state, this.applyStroke); this.updateStrokeStyle(this.state, this.applyStroke);