@realsee/dnalogel
Version:
71 lines (70 loc) • 3.19 kB
JavaScript
var r = Object.defineProperty;
var d = (n, o, e) => o in n ? r(n, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[o] = e;
var s = (n, o, e) => (d(n, typeof o != "symbol" ? o + "" : o, e), e);
import a from "hammerjs";
import h from "./BaseController.js";
import "three";
import "../Model/line.js";
import "../../shared-utils/uuid.js";
import "../utils/line.js";
import "@realsee/five/line";
import "../utils/constants.js";
import "@realsee/five";
import "../utils/dom/distanceItem.js";
import "../utils/dom/base.js";
import "../utils/isNDCPointInScreen.js";
import "../../shared-utils/three/centerPoint.js";
import "../Model/point.js";
import "../utils/ironbox.js";
class F extends h {
constructor(e) {
super(e);
s(this, "type", "view");
s(this, "hammer");
s(this, "polylineRemoved", (e) => {
e.lines.forEach((i) => this.removeLine(i)), this.hook.emit(
"selectedChange",
this.model.getAllLines().filter((i) => i.selected).map((i) => i)
);
});
s(this, "polylineAdded", (e) => {
const i = this.five.getCurrentState().panoIndex;
e.lines.forEach((t) => {
e.visiblePanoIndexes && !e.visiblePanoIndexes.includes(i) && (t.mesh.visible = !1), t.distanceItem.appendTo(this.container), t.distanceItem.update(this.five), this.group.add(t.mesh);
});
});
s(this, "onCameraUpdate", () => {
this.updateDistanceUI();
});
s(this, "onFivePanoWillArrive", (e) => {
this.model.polylines.forEach((i) => {
i.visiblePanoIndexes && (i.visiblePanoIndexes.includes(e) || i.lines.forEach((t) => {
t.mesh.visible = !1, t.distanceItem.update(this.five);
}));
});
});
s(this, "onFivePanoArrived", (e) => {
this.model.polylines.forEach((i) => {
i.visiblePanoIndexes && i.visiblePanoIndexes.includes(e) && i.lines.forEach((t) => {
t.mesh.visible = !0, t.distanceItem.update(this.five);
});
});
});
this.model.getAllLines().forEach((t) => {
t.distanceItem.appendTo(this.container), t.distanceItem.update(this.five), this.group.add(t.mesh);
});
const i = this.five.getElement();
if (i) {
const t = new a(i);
this.hammer = t;
}
this.onFivePanoWillArrive(this.five.getCurrentState().panoIndex), this.onFivePanoArrived(this.five.getCurrentState().panoIndex), this.updateDistanceUI(), this.five.needsRender = !0, this.model.hook.on("polylineAdded", this.polylineAdded), this.model.hook.on("polylineRemoved", this.polylineRemoved), this.five.on("cameraUpdate", this.onCameraUpdate), this.five.on("panoArrived", this.onFivePanoArrived), this.five.on("panoWillArrive", this.onFivePanoWillArrive);
}
dispose() {
var e;
super.dispose(), this.model.hook.off("polylineAdded", this.polylineAdded), this.model.hook.off("polylineRemoved", this.polylineRemoved), this.five.off("cameraUpdate", this.onCameraUpdate), this.five.off("panoArrived", this.onFivePanoArrived), this.five.off("panoWillArrive", this.onFivePanoWillArrive), this.five.needsRender = !0, this.hook.emit("selectedChange", []), (e = this.hammer) == null || e.destroy();
}
}
export {
F as default
};