@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.cjs
CHANGED
|
@@ -10789,11 +10789,8 @@ function getPatternTextureParameters() {
|
|
|
10789
10789
|
const params = debugGlobals().__CARTO_PATTERN_TEXTURE_PARAMS__;
|
|
10790
10790
|
return params && typeof params === "object" ? params : void 0;
|
|
10791
10791
|
}
|
|
10792
|
-
function getPatternRepeats(cell) {
|
|
10793
|
-
return Math.max(1, Math.floor(cell / SOURCE_TILE_SIZE));
|
|
10794
|
-
}
|
|
10795
10792
|
function getPatternScaleAdjustment(cell = getPatternCellSize()) {
|
|
10796
|
-
return SOURCE_TILE_SIZE
|
|
10793
|
+
return SOURCE_TILE_SIZE / cell;
|
|
10797
10794
|
}
|
|
10798
10795
|
function getPatternCellPadding(cell) {
|
|
10799
10796
|
return Math.max(2, Math.round(cell / 16));
|
|
@@ -10869,18 +10866,18 @@ async function build(cell) {
|
|
|
10869
10866
|
images[key] = await loadImage(url);
|
|
10870
10867
|
})
|
|
10871
10868
|
);
|
|
10872
|
-
const reps = getPatternRepeats(cell);
|
|
10873
|
-
const step = cell / reps;
|
|
10874
10869
|
for (const [key, frame] of Object.entries(mapping)) {
|
|
10875
10870
|
const img = images[key];
|
|
10876
10871
|
if (!img) continue;
|
|
10872
|
+
ctx.imageSmoothingEnabled = /^(diag-|cross-hatch)/.test(key);
|
|
10873
|
+
if ("imageSmoothingQuality" in ctx) ctx.imageSmoothingQuality = "high";
|
|
10877
10874
|
ctx.save();
|
|
10878
10875
|
ctx.beginPath();
|
|
10879
10876
|
ctx.rect(frame.x - pad, frame.y - pad, cell + 2 * pad, cell + 2 * pad);
|
|
10880
10877
|
ctx.clip();
|
|
10881
|
-
for (
|
|
10882
|
-
for (
|
|
10883
|
-
ctx.drawImage(img, frame.x +
|
|
10878
|
+
for (const dx of [-cell, 0, cell]) {
|
|
10879
|
+
for (const dy of [-cell, 0, cell]) {
|
|
10880
|
+
ctx.drawImage(img, frame.x + dx, frame.y + dy, cell, cell);
|
|
10884
10881
|
}
|
|
10885
10882
|
}
|
|
10886
10883
|
ctx.restore();
|