@carto/api-client 0.5.32-alpha.5d97a52.131 → 0.5.32-alpha.72cdcfe.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/api-client.js
CHANGED
|
@@ -10424,11 +10424,8 @@ function getPatternTextureParameters() {
|
|
|
10424
10424
|
const params = debugGlobals().__CARTO_PATTERN_TEXTURE_PARAMS__;
|
|
10425
10425
|
return params && typeof params === "object" ? params : void 0;
|
|
10426
10426
|
}
|
|
10427
|
-
function getPatternRepeats(cell) {
|
|
10428
|
-
return Math.max(1, Math.floor(cell / SOURCE_TILE_SIZE));
|
|
10429
|
-
}
|
|
10430
10427
|
function getPatternScaleAdjustment(cell = getPatternCellSize()) {
|
|
10431
|
-
return SOURCE_TILE_SIZE
|
|
10428
|
+
return SOURCE_TILE_SIZE / cell;
|
|
10432
10429
|
}
|
|
10433
10430
|
function getPatternCellPadding(cell) {
|
|
10434
10431
|
return Math.max(2, Math.round(cell / 16));
|
|
@@ -10504,18 +10501,18 @@ async function build(cell) {
|
|
|
10504
10501
|
images[key] = await loadImage(url);
|
|
10505
10502
|
})
|
|
10506
10503
|
);
|
|
10507
|
-
const reps = getPatternRepeats(cell);
|
|
10508
|
-
const step = cell / reps;
|
|
10509
10504
|
for (const [key, frame] of Object.entries(mapping)) {
|
|
10510
10505
|
const img = images[key];
|
|
10511
10506
|
if (!img) continue;
|
|
10507
|
+
ctx.imageSmoothingEnabled = /^(diag-|cross-hatch)/.test(key);
|
|
10508
|
+
if ("imageSmoothingQuality" in ctx) ctx.imageSmoothingQuality = "high";
|
|
10512
10509
|
ctx.save();
|
|
10513
10510
|
ctx.beginPath();
|
|
10514
10511
|
ctx.rect(frame.x - pad, frame.y - pad, cell + 2 * pad, cell + 2 * pad);
|
|
10515
10512
|
ctx.clip();
|
|
10516
|
-
for (
|
|
10517
|
-
for (
|
|
10518
|
-
ctx.drawImage(img, frame.x +
|
|
10513
|
+
for (const dx of [-cell, 0, cell]) {
|
|
10514
|
+
for (const dy of [-cell, 0, cell]) {
|
|
10515
|
+
ctx.drawImage(img, frame.x + dx, frame.y + dy, cell, cell);
|
|
10519
10516
|
}
|
|
10520
10517
|
}
|
|
10521
10518
|
ctx.restore();
|