Merge pull request #10244 from ahocevar/no-multi-assign

Update to new eslint config with no-multi-assign
This commit is contained in:
Andreas Hocevar
2019-11-02 16:48:46 +01:00
committed by GitHub
36 changed files with 191 additions and 102 deletions

46
package-lock.json generated
View File

@@ -3636,12 +3636,12 @@
}
},
"eslint-config-openlayers": {
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-openlayers/-/eslint-config-openlayers-12.0.0.tgz",
"integrity": "sha512-cln+A0qoBvf9ZTVFt9UJ1pTb+TfKOZ5B55jPtYrIcREKXsRycTtWNQjtHQJRbfTPp8CGoU6tjJ6yLUsseVgv0Q==",
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-openlayers/-/eslint-config-openlayers-13.0.0.tgz",
"integrity": "sha512-FlhPbUhrgh9nyIrcf6jX8cZHLOxl2Z4rmLnMrhwBhE+KQK2n3hywXpkNvUROWV9TQpxavzaA7punYHL4ggUpig==",
"dev": true,
"requires": {
"eslint-plugin-import": "^2.17.3"
"eslint-plugin-import": "^2.18.2"
}
},
"eslint-import-resolver-node": {
@@ -3672,9 +3672,9 @@
}
},
"eslint-module-utils": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz",
"integrity": "sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz",
"integrity": "sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw==",
"dev": true,
"requires": {
"debug": "^2.6.8",
@@ -3751,9 +3751,9 @@
}
},
"eslint-plugin-import": {
"version": "2.17.3",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.17.3.tgz",
"integrity": "sha512-qeVf/UwXFJbeyLbxuY8RgqDyEKCkqV7YC+E5S5uOjAp4tOc8zj01JP3ucoBM8JcEqd1qRasJSg6LLlisirfy0Q==",
"version": "2.18.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz",
"integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
@@ -3763,8 +3763,8 @@
"eslint-import-resolver-node": "^0.3.2",
"eslint-module-utils": "^2.4.0",
"has": "^1.0.3",
"lodash": "^4.17.11",
"minimatch": "^3.0.4",
"object.values": "^1.1.0",
"read-pkg-up": "^2.0.0",
"resolve": "^1.11.0"
},
@@ -3795,9 +3795,9 @@
"dev": true
},
"resolve": {
"version": "1.11.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz",
"integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==",
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@@ -5767,9 +5767,9 @@
"dev": true
},
"https-proxy-agent": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz",
"integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==",
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"dev": true,
"requires": {
"agent-base": "^4.3.0",
@@ -8013,6 +8013,18 @@
"isobject": "^3.0.1"
}
},
"object.values": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.0.tgz",
"integrity": "sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg==",
"dev": true,
"requires": {
"define-properties": "^1.1.3",
"es-abstract": "^1.12.0",
"function-bind": "^1.1.1",
"has": "^1.0.3"
}
},
"obuf": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",

View File

@@ -57,7 +57,7 @@
"copy-webpack-plugin": "^5.0.4",
"coveralls": "3.0.7",
"eslint": "^6.0.0",
"eslint-config-openlayers": "^12.0.0",
"eslint-config-openlayers": "^13.0.0",
"expect.js": "0.3.1",
"front-matter": "^3.0.2",
"fs-extra": "^8.0.0",

View File

@@ -512,15 +512,18 @@ class Overlay extends BaseObject {
positioning == OverlayPositioning.CENTER_RIGHT ||
positioning == OverlayPositioning.TOP_RIGHT) {
if (this.rendered.left_ !== '') {
this.rendered.left_ = style.left = '';
this.rendered.left_ = '';
style.left = '';
}
const right = Math.round(mapSize[0] - pixel[0] - offsetX) + 'px';
if (this.rendered.right_ != right) {
this.rendered.right_ = style.right = right;
this.rendered.right_ = right;
style.right = right;
}
} else {
if (this.rendered.right_ !== '') {
this.rendered.right_ = style.right = '';
this.rendered.right_ = '';
style.right = '';
}
if (positioning == OverlayPositioning.BOTTOM_CENTER ||
positioning == OverlayPositioning.CENTER_CENTER ||
@@ -529,22 +532,26 @@ class Overlay extends BaseObject {
}
const left = Math.round(pixel[0] + offsetX) + 'px';
if (this.rendered.left_ != left) {
this.rendered.left_ = style.left = left;
this.rendered.left_ = left;
style.left = left;
}
}
if (positioning == OverlayPositioning.BOTTOM_LEFT ||
positioning == OverlayPositioning.BOTTOM_CENTER ||
positioning == OverlayPositioning.BOTTOM_RIGHT) {
if (this.rendered.top_ !== '') {
this.rendered.top_ = style.top = '';
this.rendered.top_ = '';
style.top = '';
}
const bottom = Math.round(mapSize[1] - pixel[1] - offsetY) + 'px';
if (this.rendered.bottom_ != bottom) {
this.rendered.bottom_ = style.bottom = bottom;
this.rendered.bottom_ = bottom;
style.bottom = bottom;
}
} else {
if (this.rendered.bottom_ !== '') {
this.rendered.bottom_ = style.bottom = '';
this.rendered.bottom_ = '';
style.bottom = '';
}
if (positioning == OverlayPositioning.CENTER_LEFT ||
positioning == OverlayPositioning.CENTER_CENTER ||
@@ -553,7 +560,8 @@ class Overlay extends BaseObject {
}
const top = Math.round(pixel[1] + offsetY) + 'px';
if (this.rendered.top_ != top) {
this.rendered.top_ = style.top = top;
this.rendered.top_ = 'top';
style.top = top;
}
}
}

View File

@@ -124,7 +124,8 @@ class VectorRenderTile extends Tile {
this.removeSourceTiles_(this);
for (const key in this.context_) {
const canvas = this.context_[key].canvas;
canvas.width = canvas.height = 0;
canvas.width = 0;
canvas.height = 0;
}
for (const key in this.executorGroups) {
const executorGroups = this.executorGroups[key];

View File

@@ -37,10 +37,12 @@ export function createExtent(extent, onlyCenter, smooth) {
// note: when zooming out of bounds, min and max values for x and y may
// end up inverted (min > max); this has to be accounted for
if (minX > maxX) {
minX = maxX = (maxX + minX) / 2;
minX = (maxX + minX) / 2;
maxX = minX;
}
if (minY > maxY) {
minY = maxY = (maxY + minY) / 2;
minY = (maxY + minY) / 2;
maxY = minY;
}
let x = clamp(center[0], minX, maxX);

View File

@@ -72,7 +72,8 @@ class Target extends Disposable {
}
let listeners = this.listeners_[type];
if (!listeners) {
listeners = this.listeners_[type] = [];
listeners = [];
this.listeners_[type] = listeners;
}
if (listeners.indexOf(listener) === -1) {
listeners.push(listener);

View File

@@ -1777,7 +1777,9 @@ function setCommonGeometryProperties(multiGeometry, geometries) {
const tessellates = new Array(geometries.length);
const altitudeModes = new Array(geometries.length);
let hasExtrude, hasTessellate, hasAltitudeMode;
hasExtrude = hasTessellate = hasAltitudeMode = false;
hasExtrude = false;
hasTessellate = false;
hasAltitudeMode = false;
for (let i = 0; i < ii; ++i) {
const geometry = geometries[i];
extrudes[i] = geometry.get('extrude');

View File

@@ -654,7 +654,8 @@ class Modify extends PointerInteraction {
};
const featureSegments = [centerSegmentData, circumferenceSegmentData];
centerSegmentData.featureSegments = circumferenceSegmentData.featureSegments = featureSegments;
centerSegmentData.featureSegments = featureSegments;
circumferenceSegmentData.featureSegments = featureSegments;
this.rBush_.insert(createExtent(coordinates), centerSegmentData);
this.rBush_.insert(geometry.getExtent(), circumferenceSegmentData);
}
@@ -746,12 +747,14 @@ class Modify extends PointerInteraction {
switch (geometry.getType()) {
case GeometryType.POINT:
coordinates = vertex;
segment[0] = segment[1] = vertex;
segment[0] = vertex;
segment[1] = vertex;
break;
case GeometryType.MULTI_POINT:
coordinates = geometry.getCoordinates();
coordinates[segmentData.index] = vertex;
segment[0] = segment[1] = vertex;
segment[0] = vertex;
segment[1] = vertex;
break;
case GeometryType.LINE_STRING:
coordinates = geometry.getCoordinates();
@@ -774,7 +777,8 @@ class Modify extends PointerInteraction {
segment[index] = vertex;
break;
case GeometryType.CIRCLE:
segment[0] = segment[1] = vertex;
segment[0] = vertex;
segment[1] = vertex;
if (segmentData.index === CIRCLE_CENTER_INDEX) {
this.changingFeature_ = true;
geometry.setCenter(vertex);
@@ -889,8 +893,10 @@ class Modify extends PointerInteraction {
const coordinates = geometry.getCenter();
const centerSegmentData = segmentData.featureSegments[0];
const circumferenceSegmentData = segmentData.featureSegments[1];
centerSegmentData.segment[0] = centerSegmentData.segment[1] = coordinates;
circumferenceSegmentData.segment[0] = circumferenceSegmentData.segment[1] = coordinates;
centerSegmentData.segment[0] = coordinates;
centerSegmentData.segment[1] = coordinates;
circumferenceSegmentData.segment[0] = coordinates;
circumferenceSegmentData.segment[1] = coordinates;
this.rBush_.update(createExtent(coordinates), centerSegmentData);
this.rBush_.update(geometry.getExtent(), circumferenceSegmentData);
} else {

View File

@@ -198,7 +198,7 @@ class Translate extends PointerInteraction {
handleDownEvent(event) {
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
if (!this.lastCoordinate_ && this.lastFeature_) {
this.startCoordinate_ =
this.startCoordinate_ = event.coordinate;
this.lastCoordinate_ = event.coordinate;
this.handleMoveEvent(event);

View File

@@ -581,7 +581,8 @@ class Graticule extends VectorLayer {
createGraticule_(extent, center, resolution, squaredTolerance) {
const interval = this.getInterval_(resolution);
if (interval == -1) {
this.meridians_.length = this.parallels_.length = 0;
this.meridians_.length = 0;
this.parallels_.length = 0;
if (this.meridiansLabels_) {
this.meridiansLabels_.length = 0;
}
@@ -708,7 +709,8 @@ class Graticule extends VectorLayer {
const flatCoordinates = meridian(lon, minLat, maxLat, this.projection_, squaredTolerance);
let lineString = this.meridians_[index];
if (!lineString) {
lineString = this.meridians_[index] = new LineString(flatCoordinates, GeometryLayout.XY);
lineString = new LineString(flatCoordinates, GeometryLayout.XY);
this.meridians_[index] = lineString;
} else {
lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
lineString.changed();

View File

@@ -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_) {

View File

@@ -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;
/**

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);
}
}
}

View File

@@ -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];
}

View File

@@ -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();

View File

@@ -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] = [];

View File

@@ -92,7 +92,8 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
const rotation = viewState.rotation;
if (rotation) {
const size = Math.round(Math.sqrt(width * width + height * height));
width = height = size;
width = size;
height = size;
}
// set forward and inverse pixel transforms

View File

@@ -175,7 +175,8 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
if (rotation) {
const size = Math.round(Math.sqrt(width * width + height * height));
width = height = size;
width = size;
height = size;
}
const dx = tileResolution * width / 2 / tilePixelRatio;

View File

@@ -169,7 +169,10 @@ export function writePointFeatureToBuffers(instructions, elementIndex, vertexBuf
export function getBlankImageData() {
const canvas = document.createElement('canvas');
const image = canvas.getContext('2d').createImageData(1, 1);
image.data[0] = image.data[1] = image.data[2] = image.data[3] = 255;
image.data[0] = 255;
image.data[1] = 255;
image.data[2] = 255;
image.data[3] = 255;
return image;
}

View File

@@ -70,7 +70,8 @@ export function toSize(size, opt_size) {
if (opt_size === undefined) {
opt_size = [size, size];
} else {
opt_size[0] = opt_size[1] = size;
opt_size[0] = size;
opt_size[1] = size;
}
return opt_size;
}

View File

@@ -180,7 +180,8 @@ class UrlTile extends TileSource {
* @api
*/
setUrl(url) {
const urls = this.urls = expandUrl(url);
const urls = expandUrl(url);
this.urls = urls;
this.setUrls(urls);
}

View File

@@ -380,8 +380,9 @@ class VectorTile extends UrlTile {
// A tile grid that matches the tile size of the source tile grid is more
// likely to have 1:1 relationships between source tiles and rendered tiles.
const sourceTileGrid = this.tileGrid;
tileGrid = this.tileGrids_[code] = createForProjection(projection, undefined,
tileGrid = createForProjection(projection, undefined,
sourceTileGrid ? sourceTileGrid.getTileSize(sourceTileGrid.getMinZoom()) : undefined);
this.tileGrids_[code] = tileGrid;
}
return tileGrid;
}

View File

@@ -114,7 +114,7 @@ export function expandUrl(url) {
}
return urls;
}
match = match = /\{(\d+)-(\d+)\}/.exec(url);
match = /\{(\d+)-(\d+)\}/.exec(url);
if (match) {
// number range
const stop = parseInt(match[2], 10);

View File

@@ -379,10 +379,11 @@ class WebGLHelper extends Disposable {
let bufferCache = this.bufferCache_[bufferKey];
if (!bufferCache) {
const webGlBuffer = gl.createBuffer();
bufferCache = this.bufferCache_[bufferKey] = {
bufferCache = {
buffer: buffer,
webGlBuffer: webGlBuffer
};
this.bufferCache_[bufferKey] = bufferCache;
}
gl.bindBuffer(buffer.getType(), bufferCache.webGlBuffer);
}

View File

@@ -215,7 +215,8 @@ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) {
if (property in object) {
array = object[property];
} else {
array = object[property] = [];
array = [];
object[property] = array;
}
array.push(value);
}

View File

@@ -23,7 +23,8 @@ describe('ol.control.Attribution', function() {
beforeEach(function() {
const target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({
target: target,

View File

@@ -197,7 +197,8 @@ describe('ol.Map', function() {
let map;
beforeEach(function() {
const target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({
target: target,
@@ -259,7 +260,8 @@ describe('ol.Map', function() {
let target, map, layer;
beforeEach(function() {
target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
layer = new VectorLayer({
source: new VectorSource({
@@ -360,7 +362,8 @@ describe('ol.Map', function() {
useGeographic();
target = document.createElement('div');
target.style.width = target.style.height = size + 'px';
target.style.width = size + 'px';
target.style.height = size + 'px';
document.body.appendChild(target);
map = new Map({
@@ -413,7 +416,8 @@ describe('ol.Map', function() {
useGeographic();
target = document.createElement('div');
target.style.width = target.style.height = size + 'px';
target.style.width = size + 'px';
target.style.height = size + 'px';
document.body.appendChild(target);
map = new Map({

View File

@@ -81,7 +81,8 @@ describe('ol.renderer.canvas.ImageLayer', function() {
});
div = document.createElement('div');
div.style.width = div.style.height = '100px';
div.style.width = '100px';
div.style.height = '100px';
document.body.appendChild(div);
map = new Map({
target: div,
@@ -131,7 +132,8 @@ describe('ol.renderer.canvas.ImageLayer', function() {
});
div = document.createElement('div');
div.style.width = div.style.height = '100px';
div.style.width = '100px';
div.style.height = '100px';
document.body.appendChild(div);
map = new Map({
target: div,

View File

@@ -408,7 +408,8 @@ describe('ol.source.ImageWMS', function() {
source.loading = false;
});
const target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({
target: target,

View File

@@ -158,7 +158,8 @@ describe('ol.source.Vector', function() {
url: 'spec/ol/source/vectorsource/single-feature.json'
});
const target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({
target: target,
@@ -592,7 +593,8 @@ describe('ol.source.Vector', function() {
}
});
const div = document.createElement('div');
div.style.width = div.style.height = '100px';
div.style.width = '100px';
div.style.height = '100px';
document.body.appendChild(div);
const map = new Map({
target: div,

View File

@@ -198,7 +198,8 @@ describe('ol.source.VectorTile', function() {
});
target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({

View File

@@ -206,7 +206,8 @@ describe('ol.source.XYZ', function() {
}
});
const target = document.createElement('div');
target.style.width = target.style.height = '100px';
target.style.width = '100px';
target.style.height = '100px';
document.body.appendChild(target);
map = new Map({
target: target,