MCPcopy Create free account
hub / github.com/facebook/Rapid / _draw

Method _draw

modules/core/GraphicsSystem.js:535–579  ·  view source on GitHub ↗

* _draw * The "Pixi" part of the drawing. * Where it converts Pixi geometries into WebGL instructions.

()

Source from the content-addressed store, hash-verified

533 * Where it converts Pixi geometries into WebGL instructions.
534 */
535 _draw() {
536 // Resize Pixi canvas if needed..
537 // It will clear the canvas, so do this immediately before we render.
538 const pixiDims = this._pixiViewport.dimensions;
539 const canvasDims = [this.pixi.screen.width, this.pixi.screen.height];
540
541 if (!vecEqual(pixiDims, canvasDims)) {
542 const [w, h] = pixiDims;
543 // Resize supersurface and overlay to cover the screen dimensions.
544 const ssnode = this.supersurface;
545 ssnode.style.width = `${w}px`;
546 ssnode.style.height = `${h}px`;
547 const onode = this.overlay;
548 onode.style.width = `${w}px`;
549 onode.style.height = `${h}px`;
550
551 // Resize pixi canvas
552 const renderer = this.pixi.renderer;
553 renderer.resize(w, h);
554 }
555
556 // Let's go!
557 this.pixi.render();
558
559// multiview? it renders but is not interactive
560// this.pixi.renderer.render({
561// container: this.stage,
562// target: this.surface
563// });
564
565 // Remove any temporary parent transform..
566 if (this._isTempTransformed) {
567 utilSetTransform(this.supersurface, 0, 0, 1, 0);
568 utilSetTransform(this.overlay, 0, 0, 1, 0);
569 this._isTempTransformed = false;
570 this.emit('move');
571 }
572
573 this._prevTransform = this.context.viewport.transform.props;
574 this._timeToNextRender = THROTTLE;
575
576 this._drawPending = false;
577 this.emit('draw');
578 this._frame++;
579 }
580
581
582 /**

Callers 1

_tickMethod · 0.95

Calls 3

utilSetTransformFunction · 0.90
resizeMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected