UNPKG

@realsee/dnalogel

Version:
111 lines (110 loc) 4.28 kB
var E = Object.defineProperty, v = Object.defineProperties; var x = Object.getOwnPropertyDescriptors; var h = Object.getOwnPropertySymbols; var D = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable; var y = (s, e, i) => e in s ? E(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i, a = (s, e) => { for (var i in e || (e = {})) D.call(e, i) && y(s, i, e[i]); if (h) for (var i of h(e)) C.call(e, i) && y(s, i, e[i]); return s; }, c = (s, e) => v(s, x(e)); var M = (s, e) => { var i = {}; for (var t in s) D.call(s, t) && e.indexOf(t) < 0 && (i[t] = s[t]); if (s != null && h) for (var t of h(s)) e.indexOf(t) < 0 && C.call(s, t) && (i[t] = s[t]); return i; }; var l = (s, e, i) => (y(s, typeof e != "symbol" ? e + "" : e, i), i); import { anyPositionToVector3 as B } from "../../shared-utils/positionToVector3.js"; import { IObject3D as T } from "../../shared-utils/three/IObject3D.js"; import "hammerjs"; import * as j from "three"; import "@realsee/five"; import "../../vendor/@tweenjs/tween/dist/tween.esm.js.js"; import "../../CSS3DRenderPlugin/utils/three/CSS3DRender.js"; import "../../CSS3DRenderPlugin/utils/generateBehindFiveElement.js"; import "animejs"; import { notNil as F } from "../../shared-utils/isNil.js"; import { LineWithDotsMesh as H } from "./LineWithDots.js"; import { closeVectors as I } from "../../shared-utils/three/closeVectors.js"; class w extends T { constructor(i) { super(); l(this, "name", "PolylineBaseMesh"); l(this, "lines", []); l(this, "withDots"); l(this, "paramsStyle"); const n = i, { withDots: t, points: o } = n, r = M(n, ["withDots", "points"]); this.withDots = t != null ? t : !0, o && this.setPoints(o), r && this.setStyle(r); } get lineColor() { var i, t, o; return (o = (i = this.lines[0]) == null ? void 0 : i.color) != null ? o : (t = this.paramsStyle) != null && t.lineColor ? new j.Color(this.paramsStyle.lineColor) : void 0; } get lineWidth() { var i, t, o; return (o = (i = this.lines[0]) == null ? void 0 : i.lineWidth) != null ? o : (t = this.paramsStyle) == null ? void 0 : t.lineWidth; } get dashed() { var i, t, o; return (o = (i = this.lines[0]) == null ? void 0 : i.dashed) != null ? o : (t = this.paramsStyle) == null ? void 0 : t.dashed; } get occlusionVisibility() { var i, t, o; return (o = (i = this.lines[0]) == null ? void 0 : i.occlusionVisibility) != null ? o : (t = this.paramsStyle) == null ? void 0 : t.occlusionVisibility; } get points() { var i; return this.lines.map((t) => t.points[0]).concat((i = this.lines.at(-1)) == null ? void 0 : i.points[1]).filter(Boolean); } setPoints(i, t = { closed: !1 }) { var n, d, u, f, g, P, S, V; let o = i.map(B); t.closed && (o = I(o)); const r = { lineWidth: (d = (n = this.paramsStyle) == null ? void 0 : n.lineWidth) != null ? d : this.lineWidth, lineColor: (f = (u = this.paramsStyle) == null ? void 0 : u.lineColor) != null ? f : this.lineColor, dashed: (P = (g = this.paramsStyle) == null ? void 0 : g.dashed) != null ? P : this.dashed, occlusionVisibility: (V = (S = this.paramsStyle) == null ? void 0 : S.occlusionVisibility) != null ? V : this.occlusionVisibility }; this.lines.length && this.lines.forEach((m) => m.removeFromParent()), this.lines = o.map((m, p) => { const W = o[p + 1]; if (p !== 0 && W === void 0) return null; const b = new H(c(a({}, r), { pointVisibility: this.withDots ? { startPoint: p === 0, endPoint: !0 } : !1 })); return b.setPoints([m, W]), b; }).filter(F), this.add(...this.lines); } setStyle(i) { this.paramsStyle = i, this.lines.forEach((t) => t.setStyle(i)); } highlight() { this.lines.forEach((i) => i.highlight()); } unhighlight() { this.lines.forEach((i) => i.unhighlight()); } } class U extends w { constructor(...i) { super(c(a({}, i[0]), { withDots: !1 })); l(this, "name", "PolylineMesh"); } } class X extends w { constructor(...i) { super(c(a({}, i[0]), { withDots: !0 })); l(this, "name", "PolylineWithDotsMesh"); } } export { U as PolylineMesh, X as PolylineWithDotsMesh };