lythreeframe 1.2.60 → 1.2.61
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/dist/bundle.cjs.js +21 -13
- package/dist/bundle.esm.js +21 -13
- package/dist/lythreeframe/Frame/Controller.d.ts +7 -3
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -2264,11 +2264,11 @@ class Controller {
|
|
|
2264
2264
|
if (this._pointButtonIsDown.size > 0)
|
|
2265
2265
|
return;
|
|
2266
2266
|
const hits = this.getHitResultUnderCursor();
|
|
2267
|
-
const component = hits === null || hits === void 0 ? void 0 : hits.
|
|
2267
|
+
const component = hits === null || hits === void 0 ? void 0 : hits.component;
|
|
2268
2268
|
if (component !== this.hoveringComponent) {
|
|
2269
2269
|
this.clearHoveringComponent();
|
|
2270
2270
|
if (component instanceof SceneComponent && component.isHoverEnabled && hits) {
|
|
2271
|
-
this.fireHoverEvent(component, hits, true);
|
|
2271
|
+
this.fireHoverEvent(component, hits.hit, true);
|
|
2272
2272
|
}
|
|
2273
2273
|
}
|
|
2274
2274
|
}
|
|
@@ -2319,10 +2319,10 @@ class Controller {
|
|
|
2319
2319
|
}
|
|
2320
2320
|
handleFirstClick() {
|
|
2321
2321
|
const hit = this.getHitResultUnderCursor();
|
|
2322
|
-
const component = hit === null || hit === void 0 ? void 0 : hit.
|
|
2322
|
+
const component = hit === null || hit === void 0 ? void 0 : hit.component;
|
|
2323
2323
|
if (component instanceof SceneComponent && component.isClickEnabled && hit) {
|
|
2324
2324
|
this.prepareClickComponent = component;
|
|
2325
|
-
this.prepareClickHit = hit;
|
|
2325
|
+
this.prepareClickHit = hit.hit;
|
|
2326
2326
|
this.leftClickTimer = window.setTimeout(() => {
|
|
2327
2327
|
this.leftClickTimer = null;
|
|
2328
2328
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
@@ -2375,9 +2375,9 @@ class Controller {
|
|
|
2375
2375
|
}
|
|
2376
2376
|
// 广播组件按下事件
|
|
2377
2377
|
const hit = this.getHitResultUnderCursor();
|
|
2378
|
-
const component = hit === null || hit === void 0 ? void 0 : hit.
|
|
2378
|
+
const component = hit === null || hit === void 0 ? void 0 : hit.component;
|
|
2379
2379
|
if (component instanceof SceneComponent && hit) {
|
|
2380
|
-
this.firePointerDownEvent(component, hit, event.button);
|
|
2380
|
+
this.firePointerDownEvent(component, hit.hit, event.button);
|
|
2381
2381
|
}
|
|
2382
2382
|
}
|
|
2383
2383
|
firePointerDownEvent(component, hit, button) {
|
|
@@ -2414,12 +2414,7 @@ class Controller {
|
|
|
2414
2414
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2415
2415
|
const out = this.getAllHitResultFromScreenPoint(x, y);
|
|
2416
2416
|
for (const hit of out) {
|
|
2417
|
-
if (hit.
|
|
2418
|
-
continue;
|
|
2419
|
-
const component = hit.object.userData["LYObject"];
|
|
2420
|
-
if (!component)
|
|
2421
|
-
continue;
|
|
2422
|
-
if (!component.isHoverEnabled && !component.isClickEnabled)
|
|
2417
|
+
if (!hit.component.isHoverEnabled && !hit.component.isClickEnabled)
|
|
2423
2418
|
continue;
|
|
2424
2419
|
return hit;
|
|
2425
2420
|
}
|
|
@@ -2428,7 +2423,20 @@ class Controller {
|
|
|
2428
2423
|
getAllHitResultFromScreenPoint(x, y) {
|
|
2429
2424
|
this._raycastVec2.set(x, y);
|
|
2430
2425
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2431
|
-
|
|
2426
|
+
const hits = this.raycaster.intersectObjects(this.world.scene.children, true);
|
|
2427
|
+
let out = [];
|
|
2428
|
+
for (const hit of hits) {
|
|
2429
|
+
if (hit.object.userData["rayIgnored"])
|
|
2430
|
+
continue;
|
|
2431
|
+
const component = hit.object.userData["LYObject"];
|
|
2432
|
+
if (!component)
|
|
2433
|
+
continue;
|
|
2434
|
+
out.push({
|
|
2435
|
+
component: component,
|
|
2436
|
+
hit: hit
|
|
2437
|
+
});
|
|
2438
|
+
}
|
|
2439
|
+
return out;
|
|
2432
2440
|
}
|
|
2433
2441
|
focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
|
|
2434
2442
|
this.pawn.focusTo(targetPos, targetQuat, distance, time, onGoing, onFinished);
|
package/dist/bundle.esm.js
CHANGED
|
@@ -2262,11 +2262,11 @@ class Controller {
|
|
|
2262
2262
|
if (this._pointButtonIsDown.size > 0)
|
|
2263
2263
|
return;
|
|
2264
2264
|
const hits = this.getHitResultUnderCursor();
|
|
2265
|
-
const component = hits === null || hits === void 0 ? void 0 : hits.
|
|
2265
|
+
const component = hits === null || hits === void 0 ? void 0 : hits.component;
|
|
2266
2266
|
if (component !== this.hoveringComponent) {
|
|
2267
2267
|
this.clearHoveringComponent();
|
|
2268
2268
|
if (component instanceof SceneComponent && component.isHoverEnabled && hits) {
|
|
2269
|
-
this.fireHoverEvent(component, hits, true);
|
|
2269
|
+
this.fireHoverEvent(component, hits.hit, true);
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
@@ -2317,10 +2317,10 @@ class Controller {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
handleFirstClick() {
|
|
2319
2319
|
const hit = this.getHitResultUnderCursor();
|
|
2320
|
-
const component = hit === null || hit === void 0 ? void 0 : hit.
|
|
2320
|
+
const component = hit === null || hit === void 0 ? void 0 : hit.component;
|
|
2321
2321
|
if (component instanceof SceneComponent && component.isClickEnabled && hit) {
|
|
2322
2322
|
this.prepareClickComponent = component;
|
|
2323
|
-
this.prepareClickHit = hit;
|
|
2323
|
+
this.prepareClickHit = hit.hit;
|
|
2324
2324
|
this.leftClickTimer = window.setTimeout(() => {
|
|
2325
2325
|
this.leftClickTimer = null;
|
|
2326
2326
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
@@ -2373,9 +2373,9 @@ class Controller {
|
|
|
2373
2373
|
}
|
|
2374
2374
|
// 广播组件按下事件
|
|
2375
2375
|
const hit = this.getHitResultUnderCursor();
|
|
2376
|
-
const component = hit === null || hit === void 0 ? void 0 : hit.
|
|
2376
|
+
const component = hit === null || hit === void 0 ? void 0 : hit.component;
|
|
2377
2377
|
if (component instanceof SceneComponent && hit) {
|
|
2378
|
-
this.firePointerDownEvent(component, hit, event.button);
|
|
2378
|
+
this.firePointerDownEvent(component, hit.hit, event.button);
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
2381
|
firePointerDownEvent(component, hit, button) {
|
|
@@ -2412,12 +2412,7 @@ class Controller {
|
|
|
2412
2412
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2413
2413
|
const out = this.getAllHitResultFromScreenPoint(x, y);
|
|
2414
2414
|
for (const hit of out) {
|
|
2415
|
-
if (hit.
|
|
2416
|
-
continue;
|
|
2417
|
-
const component = hit.object.userData["LYObject"];
|
|
2418
|
-
if (!component)
|
|
2419
|
-
continue;
|
|
2420
|
-
if (!component.isHoverEnabled && !component.isClickEnabled)
|
|
2415
|
+
if (!hit.component.isHoverEnabled && !hit.component.isClickEnabled)
|
|
2421
2416
|
continue;
|
|
2422
2417
|
return hit;
|
|
2423
2418
|
}
|
|
@@ -2426,7 +2421,20 @@ class Controller {
|
|
|
2426
2421
|
getAllHitResultFromScreenPoint(x, y) {
|
|
2427
2422
|
this._raycastVec2.set(x, y);
|
|
2428
2423
|
this.raycaster.setFromCamera(this._raycastVec2, this.camera);
|
|
2429
|
-
|
|
2424
|
+
const hits = this.raycaster.intersectObjects(this.world.scene.children, true);
|
|
2425
|
+
let out = [];
|
|
2426
|
+
for (const hit of hits) {
|
|
2427
|
+
if (hit.object.userData["rayIgnored"])
|
|
2428
|
+
continue;
|
|
2429
|
+
const component = hit.object.userData["LYObject"];
|
|
2430
|
+
if (!component)
|
|
2431
|
+
continue;
|
|
2432
|
+
out.push({
|
|
2433
|
+
component: component,
|
|
2434
|
+
hit: hit
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
return out;
|
|
2430
2438
|
}
|
|
2431
2439
|
focusTo(targetPos, targetQuat, distance, time, onGoing = null, onFinished = null) {
|
|
2432
2440
|
this.pawn.focusTo(targetPos, targetQuat, distance, time, onGoing, onFinished);
|
|
@@ -5,6 +5,10 @@ import { Viewport } from "./Viewport";
|
|
|
5
5
|
import { Pawn } from "../Object/PawnV2/Pawn";
|
|
6
6
|
import { SceneComponent } from "../Object/Components/SceneComponent";
|
|
7
7
|
import { Delegate } from "../Delegate";
|
|
8
|
+
export interface HitResult {
|
|
9
|
+
component: SceneComponent;
|
|
10
|
+
hit: Intersection;
|
|
11
|
+
}
|
|
8
12
|
/** 组件交互事件基类 */
|
|
9
13
|
export interface ComponentInteractionEvent {
|
|
10
14
|
component: SceneComponent;
|
|
@@ -97,8 +101,8 @@ export declare class Controller {
|
|
|
97
101
|
protected onPointerLeaveEvent(_event: MouseEvent): void;
|
|
98
102
|
protected addCorePointerListeners(): void;
|
|
99
103
|
protected removeCorePointerListeners(): void;
|
|
100
|
-
getHitResultUnderCursor():
|
|
101
|
-
getHitResultFromScreenPoint(x: number, y: number):
|
|
102
|
-
getAllHitResultFromScreenPoint(x: number, y: number):
|
|
104
|
+
getHitResultUnderCursor(): HitResult | null;
|
|
105
|
+
getHitResultFromScreenPoint(x: number, y: number): HitResult | null;
|
|
106
|
+
getAllHitResultFromScreenPoint(x: number, y: number): HitResult[];
|
|
103
107
|
focusTo(targetPos: Vector3, targetQuat: Quaternion | Euler, distance: number, time: number, onGoing?: (() => void) | null, onFinished?: (() => void) | null): void;
|
|
104
108
|
}
|