@realsee/dnalogel 3.48.7 → 3.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -2
- package/dist/Sculpt/Meshes/Prism.d.ts +1 -0
- package/dist/index.cjs.js +30 -30
- package/dist/index.js +58 -62
- package/dist/index.umd.js +30 -30
- package/dist/shared-utils/Object3DHelper/Controller/RotateController.d.ts +0 -1
- package/dist/shared-utils/Object3DHelper/Controller/ScaleController.d.ts +1 -1
- package/dist/shared-utils/three/PointSelector/index.d.ts +2 -1
- package/dist/shared-utils/three/generatePolygonGeometry.d.ts +1 -1
- package/libs/Sculpt/Meshes/Prism.d.ts +1 -0
- package/libs/Sculpt/Meshes/Prism.js +47 -37
- package/libs/Sculpt/utils/Modules/Global.js +1 -1
- package/libs/base/BasePlugin.js +1 -1
- package/libs/shared-utils/Object3DHelper/Controller/MoveController.js +57 -57
- package/libs/shared-utils/Object3DHelper/Controller/RotateController.d.ts +0 -1
- package/libs/shared-utils/Object3DHelper/Controller/RotateController.js +91 -97
- package/libs/shared-utils/Object3DHelper/Controller/ScaleController.d.ts +1 -1
- package/libs/shared-utils/Object3DHelper/Controller/ScaleController.js +34 -31
- package/libs/shared-utils/logger.js +1 -1
- package/libs/shared-utils/three/PointSelector/index.d.ts +2 -1
- package/libs/shared-utils/three/generatePolygonGeometry.d.ts +1 -1
- package/libs/shared-utils/three/generatePolygonGeometry.js +8 -10
- package/package.json +1 -1
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BaseController as
|
|
5
|
-
import * as
|
|
6
|
-
import { getMouseRaycaster as
|
|
7
|
-
import { rayOnLine as
|
|
8
|
-
class
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var v = (d, a, t) => a in d ? f(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
|
|
3
|
+
var c = (d, a, t) => (v(d, typeof a != "symbol" ? a + "" : a, t), t);
|
|
4
|
+
import { BaseController as p } from "../Base/BaseController.js";
|
|
5
|
+
import * as m from "three";
|
|
6
|
+
import { getMouseRaycaster as E } from "../utils/getMouseRaycaster.js";
|
|
7
|
+
import { rayOnLine as g } from "../../../Sculpt/utils/three/rayOnLine.js";
|
|
8
|
+
class S extends p {
|
|
9
9
|
constructor(...t) {
|
|
10
10
|
super(...t);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
c(this, "name", "ScaleController");
|
|
12
|
+
c(this, "startInfo");
|
|
13
|
+
c(this, "dragStart", (t) => {
|
|
14
14
|
if (this.isDragging)
|
|
15
15
|
return;
|
|
16
16
|
this.isDragging = !0;
|
|
17
|
-
const { intersect: e } = t,
|
|
17
|
+
const { intersect: e } = t, o = this.camera.position, s = e.object, i = s.scalePosition.basePosition.clone(), r = s.scalePosition.handlePosition.clone().clone().sub(i).clone(), n = new m.Line3(i, i.clone().add(r.normalize().multiplyScalar(5)));
|
|
18
18
|
n.applyMatrix4(this.helperObject3D.matrixWorld);
|
|
19
|
-
const
|
|
20
|
-
this.startInfo = { line: n, scaleStartPoint:
|
|
19
|
+
const h = new m.Raycaster(o, e.point.clone().sub(o)), u = g({ raycaster: h, line: n });
|
|
20
|
+
this.startInfo = { line: n, scaleStartPoint: u, draggingObject: s }, this.hooks.emit("scaleStart");
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
c(this, "dragging", (t) => {
|
|
23
23
|
if (!this.isDragging || !this.startInfo)
|
|
24
24
|
return;
|
|
25
|
-
const e =
|
|
26
|
-
return
|
|
25
|
+
const e = "touches" in t ? t.touches[0].clientX : t.x, o = "touches" in t ? t.touches[0].clientY : t.y, s = E(this.camera, { x: e, y: o }, this.container);
|
|
26
|
+
return s ? (this.scale(s), !1) : this.dragEnd();
|
|
27
27
|
});
|
|
28
|
-
|
|
29
|
-
var n,
|
|
28
|
+
c(this, "scale", (t) => {
|
|
29
|
+
var n, h;
|
|
30
30
|
if (!this.startInfo)
|
|
31
31
|
return;
|
|
32
|
-
const { line: e, scaleStartPoint:
|
|
33
|
-
|
|
34
|
-
ratio:
|
|
35
|
-
intersectPoint:
|
|
32
|
+
const { line: e, scaleStartPoint: o, draggingObject: s } = this.startInfo, { scalePosition: i } = s, { basePosition: l } = i, r = g({ raycaster: t, line: e });
|
|
33
|
+
r.applyMatrix4(new m.Matrix4().getInverse(this.helperObject3D.matrixWorld.clone())), (h = (n = this.config) == null ? void 0 : n.scaleCallback) == null || h.call(n, {
|
|
34
|
+
ratio: r.distanceTo(l) / o.distanceTo(l),
|
|
35
|
+
intersectPoint: r,
|
|
36
36
|
scalePosition: i
|
|
37
|
-
}),
|
|
37
|
+
}), s.position.copy(r.clone());
|
|
38
38
|
});
|
|
39
|
-
|
|
39
|
+
c(this, "dragEnd", () => {
|
|
40
40
|
this.isDragging && (this.startInfo = void 0, this.isDragging = !1, this.internalHooks.emit("initialHelperPosition"), this.hooks.emit("scaleEnd"));
|
|
41
41
|
});
|
|
42
|
-
this.
|
|
42
|
+
const e = this.show.bind(this), o = this.hide.bind(this);
|
|
43
|
+
this.domEvents.addEventListener(this.helperObject3D, "mousedown", this.dragStart), document.addEventListener("mousemove", this.dragging), document.addEventListener("mouseup", this.dragEnd), this.domEvents.addEventListener(this.helperObject3D, "touchstart", this.dragStart), document.addEventListener("touchmove", this.dragging), document.addEventListener("touchend", this.dragEnd), this.hooks.on("rotateStart", o), this.hooks.on("rotateEnd", e), this.hooks.on("moveStart", o), this.hooks.on("moveEnd", e), this.hooks.on("moveByMouseEnable", o), this.hooks.on("moveByMouseDisable", e), this.disposers.push(() => {
|
|
44
|
+
this.domEvents.removeEventListener(this.helperObject3D, "mousedown", this.dragStart), document.removeEventListener("mousemove", this.dragging), document.removeEventListener("mouseup", this.dragEnd), this.domEvents.removeEventListener(this.helperObject3D, "touchstart", this.dragStart), document.removeEventListener("touchmove", this.dragging), document.removeEventListener("touchend", this.dragEnd), this.hooks.off("rotateStart", o), this.hooks.off("rotateEnd", e), this.hooks.off("moveStart", o), this.hooks.off("moveEnd", e), this.hooks.off("moveByMouseEnable", o), this.hooks.off("moveByMouseDisable", e);
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
47
|
initialHelperQuaternion() {
|
|
45
48
|
this.helperObject3D.initQuaternion();
|
|
@@ -50,13 +53,13 @@ class H extends b {
|
|
|
50
53
|
t.offHoverListener && t.offHoverListener(), t.offHoverListener = this.hoverListener(this.helperObject3D.scaleMeshes);
|
|
51
54
|
}
|
|
52
55
|
setScale(t) {
|
|
53
|
-
var
|
|
54
|
-
let e = 1,
|
|
55
|
-
typeof t == "number" ? (e = t,
|
|
56
|
-
const i = new
|
|
56
|
+
var r, n, h;
|
|
57
|
+
let e = 1, o = 1, s = 1;
|
|
58
|
+
typeof t == "number" ? (e = t, o = t, s = t) : typeof t == "object" && (e = (r = t.x) != null ? r : 1, o = (n = t.y) != null ? n : 1, s = (h = t.z) != null ? h : 1);
|
|
59
|
+
const i = new m.Vector3(e, o, s);
|
|
57
60
|
this.hooks.emit("wantToScale", i) || (this.originObject3D.scale.copy(i), this.internalHooks.emit("setObjectScale", i), this.hooks.emit("scale", i), this.render());
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
export {
|
|
61
|
-
|
|
64
|
+
S as ScaleController
|
|
62
65
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function A() {
|
|
2
2
|
console.debug(
|
|
3
|
-
"%c %c@realsee/dnalogel %cv3.
|
|
3
|
+
"%c %c@realsee/dnalogel %cv3.49.0",
|
|
4
4
|
[
|
|
5
5
|
"background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAMCAMAAACHgmeRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABLFBMVEUAAAAapPoap/oaqvkbrfkbr/gZnfwZoPsaqfnD4v/E4/8Ylv0clPm93/+/4P/B4f8Yj/683/8Wif+33P8Uhv+x2f8ShP+s1v8Pgf+n0/8Nf/+h0f8Lff8Lff8Nf/9dl/+czv8KfP8KfP+Lxf+Uyv+Xy/+Hwv+Jw/+Mxf+Oxv+RyP8aovsapfoap/oZmfwZm/wZnvsYnPsYkf4YlP0NePsDYfgYcfi43f+63v8Xiv8Xjf4EWfwCV/sWZ/qz2v+02/8Vh/8WiP8EUf8CTf4WXv2u1/+v2P8Thf8Thv8ETf8CR/8VV/+o1f+q1f8Qgv8Rg/8DSv8BRf8UVP+j0v+k0v8OgP8Pgf8DR/8DQv9Nhf+dzv+fz/+Kv/+Vyv+Xy/+azf+Oxv+Qx/+SyP////8MUhLdAAAAK3RSTlMACEWQ2bd98uQECPXxqO7c+Pb49vj2+Pb49vj23Oul8fMHA+TwerXXjEIG2P+bHgAAAAFiS0dEY1y+LaoAAAB+SURBVAjXY2BgZGJmYWVgYGBgY9fW0eVg4ORi4NbTNzDk4eXjZxAwMjYxNTO3EGQQsrSytrG1sxdmEHFwdHJ2cXUTZRBz9/D08vbxFWeQ8PMPCAwKDpFkkAoNC4+IjIqWZpCRlZOPiY2LV2BQVGJQTkhMUlEFWaOmrqGpxQAAyg0S9Dq+VPYAAAAASUVORK5CYII=')",
|
|
6
6
|
"background-repeat: no-repeat",
|
|
@@ -6,12 +6,13 @@ import { Subscribe } from '../../Subscribe';
|
|
|
6
6
|
import type { LiteralString } from '../../../typings/utils.type';
|
|
7
7
|
export type { PointIntersection };
|
|
8
8
|
export type ActionIfNoModelUnderMouse = LiteralString<'virtualPoint' | 'lastPoint' | 'disable'>;
|
|
9
|
+
type PointerSelectorMode = 'fixed' | 'cursor';
|
|
9
10
|
interface Config {
|
|
10
11
|
/**
|
|
11
12
|
* @description: 选点的两种模式, 'fixed' 为固定选点为屏幕中心点,拖动five画布来更新点,'cursor' 为跟随鼠标移动来更新点, 'auto' 则根据设备类型自动选择
|
|
12
13
|
* @default: 'auto'
|
|
13
14
|
*/
|
|
14
|
-
mode:
|
|
15
|
+
mode: PointerSelectorMode | 'auto';
|
|
15
16
|
/**
|
|
16
17
|
* @description 当鼠标位置没有模型时的行为
|
|
17
18
|
* ```markdown
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Vector3 } from 'three';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
4
|
+
* @description 根据多边形的顶点数组生成多边形的 BufferGeometry
|
|
5
5
|
* @param checkLinesIntersect 检查多边形边线是否相交,需要保证传入的顶点是有序的
|
|
6
6
|
*/
|
|
7
7
|
export default function generatePolygonGeometry(_points: Vector3[], config?: {
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import * as i from "three";
|
|
2
|
-
import { earcut3D as
|
|
2
|
+
import { earcut3D as f } from "./earcut3D.js";
|
|
3
3
|
import { isIntersecting as m } from "../../PanoMeasurePlugin/utils/isIntersecting.js";
|
|
4
4
|
function h(a, s) {
|
|
5
5
|
const t = [...new Set(a)];
|
|
6
6
|
if (t.length < 3)
|
|
7
7
|
return;
|
|
8
8
|
if (t.at(-1).equals(t[0]) || t.push(t[0]), s != null && s.checkLinesIntersect && t.length >= 5) {
|
|
9
|
-
const e = t.map((r,
|
|
10
|
-
if (
|
|
11
|
-
return { start: t[
|
|
9
|
+
const e = t.map((r, o) => {
|
|
10
|
+
if (o !== 0)
|
|
11
|
+
return { start: t[o - 1], end: t[o] };
|
|
12
12
|
}).filter(Boolean);
|
|
13
|
-
for (let r = 0; r < e.length; r++)
|
|
14
|
-
|
|
15
|
-
if (n && console.log("多边形边线相交", r, t), n)
|
|
13
|
+
for (let r = 0; r < e.length; r++)
|
|
14
|
+
if (m(e[r], e.slice(r)))
|
|
16
15
|
return;
|
|
17
|
-
}
|
|
18
16
|
}
|
|
19
|
-
const
|
|
20
|
-
return
|
|
17
|
+
const u = t.flatMap((e) => [e.x, e.y, e.z]), l = new i.Float32BufferAttribute(u, 3), c = f(t), n = new i.BufferGeometry();
|
|
18
|
+
return n.setAttribute("position", l), n.setIndex(c), n.name = "PolygonGeometry", n;
|
|
21
19
|
}
|
|
22
20
|
export {
|
|
23
21
|
h as generatePolygonGeometry
|