@@ -19,11 +19,11 @@ export class Profiler extends EventDispatcher {
1919 this . maxZIndex = 1002 ; // Track the highest z-index for detached windows (starts at base z-index from CSS)
2020 this . nextTabOriginalIndex = 0 ; // Track the original order of tabs as they are added
2121
22- Style . init ( ) ;
23-
2422 this . setupShell ( ) ;
2523 this . setupResizing ( ) ;
2624
25+ Style . init ( this . domElement ) ;
26+
2727 // Setup window resize listener and update mobile status
2828 this . setupWindowResizeListener ( ) ;
2929
@@ -237,31 +237,32 @@ export class Profiler extends EventDispatcher {
237237 setupShell ( ) {
238238
239239 this . domElement = document . createElement ( 'div' ) ;
240- this . domElement . id = 'profiler-shell' ;
240+
241+ this . domElement . classList . add ( 'three-inspector' ) ;
241242
242243 this . toggleButton = document . createElement ( 'button' ) ;
243- this . toggleButton . id = 'profiler-toggle' ;
244+ this . toggleButton . classList . add ( 'profiler-toggle' ) ;
244245 this . toggleButton . innerHTML = `
245- <span id ="builtin-tabs-container"></span>
246- <span id ="toggle-text">
247- <span id ="fps-counter">-</span>
246+ <span class ="builtin-tabs-container"></span>
247+ <span class ="toggle-text">
248+ <span class ="fps-counter">-</span>
248249 <span class="fps-label">FPS</span>
249250</span>
250- <span id ="toggle-icon">
251+ <span class ="toggle-icon">
251252 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-device-ipad-horizontal-search"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M11.5 20h-6.5a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v5.5" /><path d="M9 17h2" /><path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /><path d="M20.2 20.2l1.8 1.8" /></svg>
252253</span>
253254` ;
254255 this . toggleButton . onclick = ( ) => this . togglePanel ( ) ;
255256
256- this . builtinTabsContainer = this . toggleButton . querySelector ( '# builtin-tabs-container' ) ;
257+ this . builtinTabsContainer = this . toggleButton . querySelector ( '. builtin-tabs-container' ) ;
257258
258259 // Create mini-panel for builtin tabs (shown when panel is hidden)
259260 this . miniPanel = document . createElement ( 'div' ) ;
260- this . miniPanel . id = 'profiler-mini-panel' ;
261+ this . miniPanel . classList . add ( 'profiler-mini-panel' ) ;
261262 this . miniPanel . className = 'profiler-mini-panel' ;
262263
263264 this . panel = document . createElement ( 'div' ) ;
264- this . panel . id = 'profiler-panel' ;
265+ this . panel . classList . add ( 'profiler-panel' ) ;
265266
266267 const header = document . createElement ( 'div' ) ;
267268 header . className = 'profiler-header' ;
@@ -285,7 +286,7 @@ export class Profiler extends EventDispatcher {
285286 controls . className = 'profiler-controls' ;
286287
287288 this . floatingBtn = document . createElement ( 'button' ) ;
288- this . floatingBtn . id = 'floating-btn' ;
289+ this . floatingBtn . classList . add ( 'floating-btn' ) ;
289290 this . floatingBtn . title = 'Switch to Right Side' ;
290291 this . floatingBtn . innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="15" y1="3" x2="15" y2="21"></line></svg>' ;
291292 this . floatingBtn . onclick = ( ) => this . togglePosition ( ) ;
@@ -305,12 +306,12 @@ export class Profiler extends EventDispatcher {
305306 }
306307
307308 this . maximizeBtn = document . createElement ( 'button' ) ;
308- this . maximizeBtn . id = 'maximize-btn' ;
309+ this . maximizeBtn . classList . add ( 'maximize-btn' ) ;
309310 this . maximizeBtn . innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>' ;
310311 this . maximizeBtn . onclick = ( ) => this . toggleMaximize ( ) ;
311312
312313 const hideBtn = document . createElement ( 'button' ) ;
313- hideBtn . id = 'hide-panel-btn' ;
314+ hideBtn . classList . add ( 'hide-panel-btn' ) ;
314315 hideBtn . textContent = '-' ;
315316 hideBtn . onclick = ( ) => this . togglePanel ( ) ;
316317
@@ -877,15 +878,15 @@ export class Profiler extends EventDispatcher {
877878
878879 if ( isDragging && hasMoved && previewWindow ) {
879880
881+ const finalX = parseInt ( previewWindow . style . left ) + 200 ;
882+ const finalY = parseInt ( previewWindow . style . top ) + 20 ;
883+
880884 if ( previewWindow . parentNode ) {
881885
882886 previewWindow . parentNode . removeChild ( previewWindow ) ;
883887
884888 }
885889
886- const finalX = parseInt ( previewWindow . style . left ) + 200 ;
887- const finalY = parseInt ( previewWindow . style . top ) + 20 ;
888-
889890 this . detachTab ( tab , finalX , finalY ) ;
890891
891892 } else if ( ! hasMoved ) {
@@ -975,7 +976,7 @@ export class Profiler extends EventDispatcher {
975976 windowPanel . appendChild ( windowHeader ) ;
976977 windowPanel . appendChild ( windowContent ) ;
977978
978- document . body . appendChild ( windowPanel ) ;
979+ this . domElement . appendChild ( windowPanel ) ;
979980
980981 return windowPanel ;
981982
@@ -1189,7 +1190,7 @@ export class Profiler extends EventDispatcher {
11891190 windowPanel . appendChild ( windowHeader ) ;
11901191 windowPanel . appendChild ( windowContent ) ;
11911192
1192- document . body . appendChild ( windowPanel ) ;
1193+ this . domElement . appendChild ( windowPanel ) ;
11931194
11941195 // Setup window dragging
11951196 this . setupDetachedWindowDrag ( windowPanel , windowHeader , tab ) ;
0 commit comments