UNPKG

@itk-viewer/element

Version:
63 lines (62 loc) 2.18 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { LitElement, css, html } from 'lit'; import { customElement } from 'lit/decorators.js'; import { ref } from 'lit/directives/ref.js'; import { createLogic } from '@itk-viewer/vtkjs/view-3d-vtkjs.js'; import { dispatchSpawn } from './spawn-controller.js'; let ItkView3dVtkjs = class ItkView3dVtkjs extends LitElement { constructor() { super(...arguments); this.dispatched = false; } getActor() { return this.actor; } setActor(actor) { this.actor = actor; this.sendContainer(); } sendContainer() { if (!this.actor) return; this.actor.send({ type: 'setContainer', container: this.container }); } onContainer(container) { if (container instanceof HTMLElement || container == undefined) { this.container = container; this.sendContainer(); } } render() { if (!this.dispatched) { dispatchSpawn(this, 'renderer', createLogic(), (actor) => this.setActor(actor)); this.dispatched = true; } return html ` <div class="container" ${ref(this.onContainer)}></div> `; } static { this.styles = css ` :host { flex: 1; min-height: 0; display: flex; flex-direction: column; } .container { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; } `; } }; ItkView3dVtkjs = __decorate([ customElement('itk-view-3d-vtkjs') ], ItkView3dVtkjs); export { ItkView3dVtkjs }; //# sourceMappingURL=itk-view-3d-vtkjs.js.map