@xterm/addon-webgl 0.20.0-beta.298 → 0.20.0-beta.299
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xterm/addon-webgl",
|
|
3
|
-
"version": "0.20.0-beta.
|
|
3
|
+
"version": "0.20.0-beta.299",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "The xterm.js authors",
|
|
6
6
|
"url": "https://xtermjs.org/"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"prepublishOnly": "npm run package",
|
|
24
24
|
"start": "node ../../demo/start"
|
|
25
25
|
},
|
|
26
|
-
"commit": "
|
|
26
|
+
"commit": "d3e32b344dfe7dd6015cff6a9aeaaeaeccdc2789",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@xterm/xterm": "^6.1.0-beta.
|
|
28
|
+
"@xterm/xterm": "^6.1.0-beta.303"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -8,6 +8,29 @@ import type { ILogService } from 'common/services/Services';
|
|
|
8
8
|
import { customGlyphDefinitions } from './CustomGlyphDefinitions';
|
|
9
9
|
import { CustomGlyphDefinitionType, CustomGlyphScaleType, CustomGlyphVectorType, type CustomGlyphDefinitionPart, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from './Types';
|
|
10
10
|
|
|
11
|
+
type PatternCanvas = HTMLCanvasElement | OffscreenCanvas;
|
|
12
|
+
type PatternCanvasFactory = (width: number, height: number) => PatternCanvas;
|
|
13
|
+
|
|
14
|
+
const createOffscreenPatternCanvas: PatternCanvasFactory | undefined = typeof OffscreenCanvas === 'undefined'
|
|
15
|
+
? undefined
|
|
16
|
+
: (width, height) => new OffscreenCanvas(width, height);
|
|
17
|
+
|
|
18
|
+
const createDomPatternCanvas: PatternCanvasFactory = (width, height) => {
|
|
19
|
+
const canvas = document.createElement('canvas');
|
|
20
|
+
canvas.width = width;
|
|
21
|
+
canvas.height = height;
|
|
22
|
+
return canvas;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function createPatternCanvas(
|
|
26
|
+
width: number,
|
|
27
|
+
height: number,
|
|
28
|
+
offscreenCanvasFactory: PatternCanvasFactory | undefined = createOffscreenPatternCanvas,
|
|
29
|
+
domCanvasFactory: PatternCanvasFactory = createDomPatternCanvas
|
|
30
|
+
): PatternCanvas {
|
|
31
|
+
return offscreenCanvasFactory?.(width, height) ?? domCanvasFactory(width, height);
|
|
32
|
+
}
|
|
33
|
+
|
|
11
34
|
/**
|
|
12
35
|
* Try drawing a custom block element or box drawing character, returning whether it was
|
|
13
36
|
* successfully drawn.
|
|
@@ -458,9 +481,9 @@ function drawPatternChar(
|
|
|
458
481
|
if (!pattern) {
|
|
459
482
|
const width = charDefinition[0].length;
|
|
460
483
|
const height = charDefinition.length;
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
tmpCanvas
|
|
484
|
+
// The atlas canvas can be adopted into another document, so temporary resources must not use
|
|
485
|
+
// its mutable ownerDocument.
|
|
486
|
+
const tmpCanvas = createPatternCanvas(width, height);
|
|
464
487
|
const tmpCtx = throwIfFalsy(tmpCanvas.getContext('2d'));
|
|
465
488
|
const imageData = new ImageData(width, height);
|
|
466
489
|
|