MCPcopy
hub / github.com/opentrace/opentrace / _init

Method _init

ui/src/components/pixi/PixiRenderer.ts:362–518  ·  view source on GitHub ↗
(
    container: HTMLElement,
    width: number,
    height: number,
  )

Source from the content-addressed store, hash-verified

360 }
361
362 private async _init(
363 container: HTMLElement,
364 width: number,
365 height: number,
366 ): Promise<void> {
367 this.width = width;
368 this.height = height;
369
370 const app = new Application();
371 const themeColors = getGraphThemeColors();
372 try {
373 await app.init({
374 width,
375 height,
376 backgroundColor: hexToNum(themeColors.bg),
377 antialias: true,
378 resolution: window.devicePixelRatio || 1,
379 autoDensity: true,
380 });
381 } catch (err) {
382 if (
383 err instanceof TypeError &&
384 /dynamically imported module|importing a module script/i.test(
385 err.message,
386 )
387 ) {
388 window.location.reload();
389 return;
390 }
391 throw err;
392 }
393
394 // Guard: if destroy() was called while init was pending, don't proceed
395 if (this.destroyed) {
396 app.destroy({ removeView: true });
397 return;
398 }
399
400 this.app = app;
401 container.appendChild(app.canvas);
402
403 // Scene graph
404 const world = new Container();
405 app.stage.addChild(world);
406 this.world = world;
407
408 const edgeBgGfx = new Graphics();
409 world.addChild(edgeBgGfx);
410 this.edgeBgGfx = edgeBgGfx;
411
412 const edgeFgGfx = new Graphics();
413 world.addChild(edgeFgGfx);
414 this.edgeFgGfx = edgeFgGfx;
415
416 const nodeContainer = new Container();
417 nodeContainer.sortableChildren = true;
418 world.addChild(nodeContainer);
419 this.nodeContainer = nodeContainer;

Callers 1

initMethod · 0.95

Calls 11

applyCounterScaleMethod · 0.95
update3DMethod · 0.95
applyPingAnimationsMethod · 0.95
zoomInvScaleMethod · 0.95
setupInteractionMethod · 0.95
getGraphThemeColorsFunction · 0.90
hexToNumFunction · 0.85
destroyMethod · 0.80
initMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected