Skip to content

Commit 4cc3a8d

Browse files
authored
Custom source debug page support for Safari and Firefox (#11680)
1 parent d5a5145 commit 4cc3a8d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

debug/custom-source.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141
tileSize,
4242
async loadTile({z, x, y}) {
4343
const tileSize = 256;
44-
const offscreenCanvas = new OffscreenCanvas(tileSize, tileSize);
45-
const context = offscreenCanvas.getContext('2d');
44+
const canvas = document.createElement('canvas');
45+
canvas.width = canvas.height = tileSize;
46+
const context = canvas.getContext('2d');
4647
context.fillStyle = 'red';
4748
context.fillRect(0, 0, tileSize, tileSize);
4849

@@ -56,8 +57,9 @@
5657
},
5758
prepareTile({z, x, y}) {
5859
const tileSize = 256;
59-
const offscreenCanvas = new OffscreenCanvas(tileSize, tileSize);
60-
const context = offscreenCanvas.getContext('2d');
60+
const canvas = document.createElement('canvas');
61+
canvas.width = canvas.height = tileSize;
62+
const context = canvas.getContext('2d');
6163
context.fillStyle = currentColor;
6264
context.fillRect(0, 0, tileSize, tileSize);
6365

0 commit comments

Comments
 (0)