File tree Expand file tree Collapse file tree
XnaFiddle.BlazorGL/wwwroot Expand file tree Collapse file tree Original file line number Diff line number Diff line change 129129 // Subtract remainder to avoid drift accumulating over time
130130 window . _lastTickTime = now - ( elapsed % window . _tickInterval ) ;
131131 }
132- // Sync canvas drawing buffer to its container each frame
132+ // Sync canvas drawing buffer to its container each frame — but NOT while a splitter is
133+ // being dragged (issue #105). Assigning canvas.width/height REALLOCATES the WebGL drawing
134+ // buffer, and on Windows Chrome (ANGLE -> D3D11) a fresh buffer is filled with magenta as
135+ // its uninitialized pattern. Normally invisible because the game's Draw repaints it that
136+ // same frame — but a splitter drag changes the holder size every frame while the game step
137+ // may be skipped (touch, _uiDragging) or lag the resize, so the raw magenta buffer shows
138+ // through for the whole drag. Instead we let the last-good buffer stretch via CSS
139+ // (#theCanvas is width/height:100% of the holder) during the drag — slightly soft — and
140+ // reallocate once on drag-end: the first tick after _uiDragging clears sees the size
141+ // mismatch below and snaps the buffer crisp. This also removes the per-frame realloc +
142+ // OnCanvasResized churn during a drag. Both splitter handlers set _uiDragging.
133143 var canvas = document . getElementById ( 'theCanvas' ) ;
134144 var holder = document . getElementById ( 'canvasHolder' ) ;
135- if ( canvas && holder ) {
145+ if ( canvas && holder && ! window . _uiDragging ) {
136146 var w = holder . clientWidth ;
137147 var h = holder . clientHeight ;
138148 if ( canvas . width !== w || canvas . height !== h ) {
You can’t perform that action at this time.
0 commit comments