@@ -62,56 +62,6 @@ const COLOR_CTX_PROPS = new Set(["fillStyle", "shadowColor", "strokeStyle"]);
6262
6363const MATHML_NS = "http://www.w3.org/1998/Math/MathML" ;
6464
65- // Cached media queries used by drawCheckerboard.
66- const _prefersDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
67- const _prefersHCM = window . matchMedia ( "(forced-colors: active)" ) ;
68-
69- /**
70- * Draw a checkerboard pattern filling the canvas, to reveal transparency.
71- * Mirrors the pattern used in src/display/editor/stamp.js.
72- */
73- function drawCheckerboard ( ctx , width , height ) {
74- const isHCM = _prefersHCM . matches ;
75- const isDark = _prefersDark . matches ;
76- let light , dark ;
77- if ( isHCM ) {
78- light = "white" ;
79- dark = "black" ;
80- } else if ( isDark ) {
81- light = "#8f8f9d" ;
82- dark = "#42414d" ;
83- } else {
84- light = "white" ;
85- dark = "#cfcfd8" ;
86- }
87- const boxDim = 15 ;
88- const pattern =
89- typeof OffscreenCanvas !== "undefined"
90- ? new OffscreenCanvas ( boxDim * 2 , boxDim * 2 )
91- : Object . assign ( document . createElement ( "canvas" ) , {
92- width : boxDim * 2 ,
93- height : boxDim * 2 ,
94- } ) ;
95- const patternCtx = pattern . getContext ( "2d" ) ;
96- if ( ! patternCtx ) {
97- return ;
98- }
99- patternCtx . fillStyle = light ;
100- patternCtx . fillRect ( 0 , 0 , boxDim * 2 , boxDim * 2 ) ;
101- patternCtx . fillStyle = dark ;
102- patternCtx . fillRect ( 0 , 0 , boxDim , boxDim ) ;
103- patternCtx . fillRect ( boxDim , boxDim , boxDim , boxDim ) ;
104- ctx . save ( ) ;
105- const fillPattern = ctx . createPattern ( pattern , "repeat" ) ;
106- if ( ! fillPattern ) {
107- ctx . restore ( ) ;
108- return ;
109- }
110- ctx . fillStyle = fillPattern ;
111- ctx . fillRect ( 0 , 0 , width , height ) ;
112- ctx . restore ( ) ;
113- }
114-
11565/**
11666 * Tracks and displays the CanvasRenderingContext2D graphics state for all
11767 * contexts created during a stepped render.
@@ -240,12 +190,6 @@ class CanvasContextDetailsView {
240190 return ctx ;
241191 }
242192 if ( ! wrappedCtx ) {
243- if (
244- globalThis . StepperManager . _active !== null &&
245- args [ 0 ] ?. alpha !== false
246- ) {
247- drawCheckerboard ( ctx , canvas . width , canvas . height ) ;
248- }
249193 wrappedCtx = this . wrapContext ( ctx , label ) ;
250194 }
251195 return wrappedCtx ;
0 commit comments