New eslint config with no-multi-assign
This commit is contained in:
@@ -74,7 +74,10 @@ class RenderBox extends Disposable {
|
||||
if (this.map_) {
|
||||
this.map_.getOverlayContainer().removeChild(this.element_);
|
||||
const style = this.element_.style;
|
||||
style.left = style.top = style.width = style.height = 'inherit';
|
||||
style.left = 'inherit';
|
||||
style.top = 'inherit';
|
||||
style.width = 'inherit';
|
||||
style.height = 'inherit';
|
||||
}
|
||||
this.map_ = map;
|
||||
if (this.map_) {
|
||||
|
||||
@@ -268,10 +268,10 @@ class RenderFeature {
|
||||
/**
|
||||
* @return {Array<number>|Array<Array<number>>} Ends or endss.
|
||||
*/
|
||||
RenderFeature.prototype.getEnds =
|
||||
RenderFeature.prototype.getEndss = function() {
|
||||
RenderFeature.prototype.getEnds = function() {
|
||||
return this.ends_;
|
||||
};
|
||||
RenderFeature.prototype.getEndss = RenderFeature.prototype.getEnds;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -311,13 +311,15 @@ export const measureTextHeight = (function() {
|
||||
if (!div) {
|
||||
div = document.createElement('div');
|
||||
div.innerHTML = 'M';
|
||||
div.style.margin = div.style.padding = '0 !important';
|
||||
div.style.margin = '0 !important';
|
||||
div.style.padding = '0 !important';
|
||||
div.style.position = 'absolute !important';
|
||||
div.style.left = '-99999px !important';
|
||||
}
|
||||
div.style.font = font;
|
||||
document.body.appendChild(div);
|
||||
height = heights[font] = div.offsetHeight;
|
||||
height = div.offsetHeight;
|
||||
heights[font] = height;
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
return height;
|
||||
@@ -351,7 +353,8 @@ export function measureAndCacheTextWidth(font, text, cache) {
|
||||
if (text in cache) {
|
||||
return cache[text];
|
||||
}
|
||||
const width = cache[text] = measureTextWidth(font, text);
|
||||
const width = measureTextWidth(font, text);
|
||||
cache[text] = width;
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,8 @@ class BuilderGroup {
|
||||
declutter = this.declutterGroups_;
|
||||
/** @type {number} */ (declutter[0][4])++;
|
||||
} else {
|
||||
declutter = this.declutterGroups_ = [createEmpty()];
|
||||
declutter = [createEmpty()];
|
||||
this.declutterGroups_ = declutter;
|
||||
declutter[0].push(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,10 +315,14 @@ class Executor extends Disposable {
|
||||
const boxY = y - padding[0];
|
||||
|
||||
if (fillStroke || rotation !== 0) {
|
||||
p1[0] = p4[0] = boxX;
|
||||
p1[1] = p2[1] = boxY;
|
||||
p2[0] = p3[0] = boxX + boxW;
|
||||
p3[1] = p4[1] = boxY + boxH;
|
||||
p1[0] = boxX;
|
||||
p4[0] = boxX;
|
||||
p1[1] = boxY;
|
||||
p2[1] = boxY;
|
||||
p2[0] = boxX + boxW;
|
||||
p3[0] = p2[0];
|
||||
p3[1] = boxY + boxH;
|
||||
p4[1] = p3[1];
|
||||
}
|
||||
|
||||
let transform = null;
|
||||
@@ -576,7 +580,8 @@ class Executor extends Disposable {
|
||||
}
|
||||
if (!pendingFill && !pendingStroke) {
|
||||
context.beginPath();
|
||||
prevX = prevY = NaN;
|
||||
prevX = NaN;
|
||||
prevY = NaN;
|
||||
}
|
||||
++i;
|
||||
break;
|
||||
@@ -644,13 +649,18 @@ class Executor extends Disposable {
|
||||
strokeKey = /** @type {string} */ (instruction[20]);
|
||||
fillKey = /** @type {string} */ (instruction[21]);
|
||||
const labelWithAnchor = this.drawTextImageWithPointPlacement_(text, textKey, strokeKey, fillKey);
|
||||
image = instruction[3] = labelWithAnchor.label;
|
||||
image = labelWithAnchor.label;
|
||||
instruction[3] = image;
|
||||
const textOffsetX = /** @type {number} */ (instruction[22]);
|
||||
anchorX = instruction[4] = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;
|
||||
anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;
|
||||
instruction[4] = anchorX;
|
||||
const textOffsetY = /** @type {number} */ (instruction[23]);
|
||||
anchorY = instruction[5] = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;
|
||||
height = instruction[7] = image.height;
|
||||
width = instruction[14] = image.width;
|
||||
anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;
|
||||
instruction[5] = anchorY;
|
||||
height = image.height;
|
||||
instruction[7] = height;
|
||||
width = image.width;
|
||||
instruction[14] = width;
|
||||
}
|
||||
|
||||
let geometryWidths;
|
||||
@@ -665,7 +675,8 @@ class Executor extends Disposable {
|
||||
backgroundStroke = /** @type {boolean} */ (instruction[17]);
|
||||
} else {
|
||||
padding = defaultPadding;
|
||||
backgroundFill = backgroundStroke = false;
|
||||
backgroundFill = false;
|
||||
backgroundStroke = false;
|
||||
}
|
||||
|
||||
if (rotateWithView && viewRotationFromTransform) {
|
||||
@@ -730,7 +741,8 @@ class Executor extends Disposable {
|
||||
if (font in this.widths_) {
|
||||
cachedWidths = this.widths_[font];
|
||||
} else {
|
||||
cachedWidths = this.widths_[font] = {};
|
||||
cachedWidths = {};
|
||||
this.widths_[font] = cachedWidths;
|
||||
}
|
||||
|
||||
const pathLength = lineStringLength(pixelCoordinates, begin, end, 2);
|
||||
|
||||
@@ -116,7 +116,8 @@ class ExecutorGroup extends Disposable {
|
||||
for (const zIndex in allInstructions) {
|
||||
let executors = this.executorsByZIndex_[zIndex];
|
||||
if (executors === undefined) {
|
||||
this.executorsByZIndex_[zIndex] = executors = {};
|
||||
executors = {};
|
||||
this.executorsByZIndex_[zIndex] = executors;
|
||||
}
|
||||
const instructionByZindex = allInstructions[zIndex];
|
||||
for (const builderType in instructionByZindex) {
|
||||
@@ -139,7 +140,8 @@ class ExecutorGroup extends Disposable {
|
||||
}
|
||||
if (this.hitDetectionContext_) {
|
||||
const canvas = this.hitDetectionContext_.canvas;
|
||||
canvas.width = canvas.height = 0;
|
||||
canvas.width = 0;
|
||||
canvas.height = 0;
|
||||
}
|
||||
|
||||
super.disposeInternal();
|
||||
|
||||
@@ -719,7 +719,8 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
};
|
||||
} else {
|
||||
if (contextFillState.fillStyle != fillState.fillStyle) {
|
||||
contextFillState.fillStyle = context.fillStyle = fillState.fillStyle;
|
||||
contextFillState.fillStyle = fillState.fillStyle;
|
||||
context.fillStyle = fillState.fillStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -752,30 +753,33 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
};
|
||||
} else {
|
||||
if (contextStrokeState.lineCap != strokeState.lineCap) {
|
||||
contextStrokeState.lineCap = context.lineCap = strokeState.lineCap;
|
||||
contextStrokeState.lineCap = strokeState.lineCap;
|
||||
context.lineCap = strokeState.lineCap;
|
||||
}
|
||||
if (context.setLineDash) {
|
||||
if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {
|
||||
context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash);
|
||||
}
|
||||
if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {
|
||||
contextStrokeState.lineDashOffset = context.lineDashOffset =
|
||||
strokeState.lineDashOffset;
|
||||
contextStrokeState.lineDashOffset = strokeState.lineDashOffset;
|
||||
context.lineDashOffset = strokeState.lineDashOffset;
|
||||
}
|
||||
}
|
||||
if (contextStrokeState.lineJoin != strokeState.lineJoin) {
|
||||
contextStrokeState.lineJoin = context.lineJoin = strokeState.lineJoin;
|
||||
contextStrokeState.lineJoin = strokeState.lineJoin;
|
||||
context.lineJoin = strokeState.lineJoin;
|
||||
}
|
||||
if (contextStrokeState.lineWidth != strokeState.lineWidth) {
|
||||
contextStrokeState.lineWidth = context.lineWidth = strokeState.lineWidth;
|
||||
contextStrokeState.lineWidth = strokeState.lineWidth;
|
||||
context.lineWidth = strokeState.lineWidth;
|
||||
}
|
||||
if (contextStrokeState.miterLimit != strokeState.miterLimit) {
|
||||
contextStrokeState.miterLimit = context.miterLimit =
|
||||
strokeState.miterLimit;
|
||||
contextStrokeState.miterLimit = strokeState.miterLimit;
|
||||
context.miterLimit = strokeState.miterLimit;
|
||||
}
|
||||
if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {
|
||||
contextStrokeState.strokeStyle = context.strokeStyle =
|
||||
strokeState.strokeStyle;
|
||||
contextStrokeState.strokeStyle = strokeState.strokeStyle;
|
||||
context.strokeStyle = strokeState.strokeStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,14 +804,16 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
};
|
||||
} else {
|
||||
if (contextTextState.font != textState.font) {
|
||||
contextTextState.font = context.font = textState.font;
|
||||
contextTextState.font = textState.font;
|
||||
context.font = textState.font;
|
||||
}
|
||||
if (contextTextState.textAlign != textAlign) {
|
||||
contextTextState.textAlign = context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
|
||||
contextTextState.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
|
||||
context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
|
||||
}
|
||||
if (contextTextState.textBaseline != textState.textBaseline) {
|
||||
contextTextState.textBaseline = context.textBaseline =
|
||||
/** @type {CanvasTextBaseline} */ (textState.textBaseline);
|
||||
contextTextState.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
|
||||
context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ class LabelCache extends LRUCache {
|
||||
}
|
||||
}
|
||||
const canvas = this.pop();
|
||||
canvas.width = canvas.height = 0;
|
||||
canvas.width = 0;
|
||||
canvas.height = 0;
|
||||
for (const consumerId in this.consumers) {
|
||||
delete this.consumers[consumerId][key];
|
||||
}
|
||||
|
||||
@@ -392,11 +392,13 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
|
||||
const textFillStyle = textStyle.getFill();
|
||||
if (!textFillStyle) {
|
||||
fillState = this.textFillState_ = null;
|
||||
fillState = null;
|
||||
this.textFillState_ = fillState;
|
||||
} else {
|
||||
fillState = this.textFillState_;
|
||||
if (!fillState) {
|
||||
fillState = this.textFillState_ = /** @type {import("../canvas.js").FillState} */ ({});
|
||||
fillState = /** @type {import("../canvas.js").FillState} */ ({});
|
||||
this.textFillState_ = fillState;
|
||||
}
|
||||
fillState.fillStyle = asColorLike(
|
||||
textFillStyle.getColor() || defaultFillStyle);
|
||||
@@ -404,11 +406,13 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
|
||||
const textStrokeStyle = textStyle.getStroke();
|
||||
if (!textStrokeStyle) {
|
||||
strokeState = this.textStrokeState_ = null;
|
||||
strokeState = null;
|
||||
this.textStrokeState_ = strokeState;
|
||||
} else {
|
||||
strokeState = this.textStrokeState_;
|
||||
if (!strokeState) {
|
||||
strokeState = this.textStrokeState_ = /** @type {import("../canvas.js").StrokeState} */ ({});
|
||||
strokeState = /** @type {import("../canvas.js").StrokeState} */ ({});
|
||||
this.textStrokeState_ = strokeState;
|
||||
}
|
||||
const lineDash = textStrokeStyle.getLineDash();
|
||||
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
||||
|
||||
@@ -90,7 +90,8 @@ export function createHitDetectionImageData(size, transforms, features, styleFun
|
||||
const zIndex = Number(style.getZIndex());
|
||||
let byGeometryType = featuresByZIndex[zIndex];
|
||||
if (!byGeometryType) {
|
||||
byGeometryType = featuresByZIndex[zIndex] = {};
|
||||
byGeometryType = {};
|
||||
featuresByZIndex[zIndex] = byGeometryType;
|
||||
byGeometryType[GeometryType.POLYGON] = [];
|
||||
byGeometryType[GeometryType.CIRCLE] = [];
|
||||
byGeometryType[GeometryType.LINE_STRING] = [];
|
||||
|
||||
Reference in New Issue
Block a user