lythreeframe 1.2.54 → 1.2.56
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 +30 -52
- package/dist/bundle.esm.js +30 -52
- package/dist/lythreeframe/Frame/Controller.d.ts +9 -2
- package/package.json +3 -3
package/dist/bundle.cjs.js
CHANGED
|
@@ -1896,7 +1896,7 @@ class Viewport {
|
|
|
1896
1896
|
// Post processing rendered
|
|
1897
1897
|
}
|
|
1898
1898
|
else {
|
|
1899
|
-
await this.renderer.
|
|
1899
|
+
await this.renderer.render(this.app.world.scene, this.app.camera);
|
|
1900
1900
|
}
|
|
1901
1901
|
// 检查 renderer.domElement 的尺寸
|
|
1902
1902
|
const sourceWidth = this.renderer.domElement.width;
|
|
@@ -2169,6 +2169,7 @@ class Controller {
|
|
|
2169
2169
|
this._pawn = null;
|
|
2170
2170
|
this.prepareClickComponent = null;
|
|
2171
2171
|
this.prepareClickHit = null;
|
|
2172
|
+
this.prepareClickModifiers = { ctrlKey: false, shiftKey: false, altKey: false };
|
|
2172
2173
|
this.hoveringComponent = null;
|
|
2173
2174
|
this._pointButtonIsDown = new Set();
|
|
2174
2175
|
this._onClickNothingDelegate = new Delegate();
|
|
@@ -2279,6 +2280,12 @@ class Controller {
|
|
|
2279
2280
|
this.clearClickTimer();
|
|
2280
2281
|
return;
|
|
2281
2282
|
}
|
|
2283
|
+
// 保存修饰键状态
|
|
2284
|
+
this.prepareClickModifiers = {
|
|
2285
|
+
ctrlKey: event.ctrlKey,
|
|
2286
|
+
shiftKey: event.shiftKey,
|
|
2287
|
+
altKey: event.altKey
|
|
2288
|
+
};
|
|
2282
2289
|
if (!this.leftClickTimer) {
|
|
2283
2290
|
this.handleFirstClick();
|
|
2284
2291
|
}
|
|
@@ -2295,7 +2302,7 @@ class Controller {
|
|
|
2295
2302
|
this.leftClickTimer = window.setTimeout(() => {
|
|
2296
2303
|
this.leftClickTimer = null;
|
|
2297
2304
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
2298
|
-
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, false);
|
|
2305
|
+
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, false, this.prepareClickModifiers);
|
|
2299
2306
|
this.prepareClickComponent = null;
|
|
2300
2307
|
this.prepareClickHit = null;
|
|
2301
2308
|
}
|
|
@@ -2308,7 +2315,7 @@ class Controller {
|
|
|
2308
2315
|
handleDoubleClick() {
|
|
2309
2316
|
this.clearClickTimer();
|
|
2310
2317
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
2311
|
-
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, true);
|
|
2318
|
+
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, true, this.prepareClickModifiers);
|
|
2312
2319
|
}
|
|
2313
2320
|
else {
|
|
2314
2321
|
this._onClickNothingDelegate.broadcast();
|
|
@@ -2316,8 +2323,8 @@ class Controller {
|
|
|
2316
2323
|
this.prepareClickComponent = null;
|
|
2317
2324
|
this.prepareClickHit = null;
|
|
2318
2325
|
}
|
|
2319
|
-
fireClickEvent(component, hit, isDoubleClick) {
|
|
2320
|
-
const event = { component, hit, handled: false };
|
|
2326
|
+
fireClickEvent(component, hit, isDoubleClick, modifiers) {
|
|
2327
|
+
const event = Object.assign({ component, hit, handled: false }, modifiers);
|
|
2321
2328
|
if (isDoubleClick) {
|
|
2322
2329
|
this._onComponentDoubleClickDelegate.broadcast(event);
|
|
2323
2330
|
if (!event.handled) {
|
|
@@ -2353,10 +2360,10 @@ class Controller {
|
|
|
2353
2360
|
const event = { component, hit, button, handled: false };
|
|
2354
2361
|
this._onComponentPointerDownDelegate.broadcast(event);
|
|
2355
2362
|
}
|
|
2356
|
-
onPointerEnterEvent(
|
|
2363
|
+
onPointerEnterEvent(_event) {
|
|
2357
2364
|
this.addCorePointerListeners();
|
|
2358
2365
|
}
|
|
2359
|
-
onPointerLeaveEvent(
|
|
2366
|
+
onPointerLeaveEvent(_event) {
|
|
2360
2367
|
this.removeCorePointerListeners();
|
|
2361
2368
|
}
|
|
2362
2369
|
addCorePointerListeners() {
|
|
@@ -3506,19 +3513,6 @@ class FirstPerson extends Pawn {
|
|
|
3506
3513
|
}
|
|
3507
3514
|
}
|
|
3508
3515
|
|
|
3509
|
-
function debounce(func, delay) {
|
|
3510
|
-
let timeoutId = null;
|
|
3511
|
-
return (...args) => {
|
|
3512
|
-
if (timeoutId) {
|
|
3513
|
-
clearTimeout(timeoutId);
|
|
3514
|
-
}
|
|
3515
|
-
timeoutId = setTimeout(() => {
|
|
3516
|
-
func(...args);
|
|
3517
|
-
timeoutId = null;
|
|
3518
|
-
}, delay);
|
|
3519
|
-
};
|
|
3520
|
-
}
|
|
3521
|
-
|
|
3522
3516
|
class TransformGizmo extends Pawn {
|
|
3523
3517
|
get control() {
|
|
3524
3518
|
if (!this._control) {
|
|
@@ -3596,38 +3590,22 @@ class TransformGizmo extends Pawn {
|
|
|
3596
3590
|
}
|
|
3597
3591
|
}
|
|
3598
3592
|
onObjectChanged() {
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
if (t) {
|
|
3616
|
-
let p2 = new webgpu.Vector3();
|
|
3617
|
-
let q2 = new webgpu.Quaternion();
|
|
3618
|
-
let s2 = new webgpu.Vector3();
|
|
3619
|
-
let TB2 = new webgpu.Matrix4().multiplyMatrices(TA2, t); // B
|
|
3620
|
-
TB2.decompose(p2, q2, s2);
|
|
3621
|
-
tar.onTransforming(TB2);
|
|
3622
|
-
}
|
|
3623
|
-
}
|
|
3624
|
-
});
|
|
3625
|
-
}
|
|
3626
|
-
if (this.onUpdateFunction) {
|
|
3627
|
-
this.onUpdateFunction();
|
|
3628
|
-
}
|
|
3629
|
-
}, 50);
|
|
3630
|
-
de();
|
|
3593
|
+
if (this.primaryTarget) {
|
|
3594
|
+
this.helperObject.updateMatrixWorld(true);
|
|
3595
|
+
const TA2 = this.helperObject.matrixWorld.clone();
|
|
3596
|
+
this.primaryTarget.onTransforming(TA2);
|
|
3597
|
+
// Apply transform to all additional targets
|
|
3598
|
+
this.targets.forEach((tar, index) => {
|
|
3599
|
+
const relativeMatrix = this.targetMatrixMap.get(tar);
|
|
3600
|
+
if (relativeMatrix) {
|
|
3601
|
+
const TB2 = new webgpu.Matrix4().multiplyMatrices(TA2, relativeMatrix);
|
|
3602
|
+
tar.onTransforming(TB2);
|
|
3603
|
+
}
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
if (this.onUpdateFunction) {
|
|
3607
|
+
this.onUpdateFunction();
|
|
3608
|
+
}
|
|
3631
3609
|
}
|
|
3632
3610
|
set enable(newEnable) {
|
|
3633
3611
|
this.control.enabled = newEnable;
|
package/dist/bundle.esm.js
CHANGED
|
@@ -1894,7 +1894,7 @@ class Viewport {
|
|
|
1894
1894
|
// Post processing rendered
|
|
1895
1895
|
}
|
|
1896
1896
|
else {
|
|
1897
|
-
await this.renderer.
|
|
1897
|
+
await this.renderer.render(this.app.world.scene, this.app.camera);
|
|
1898
1898
|
}
|
|
1899
1899
|
// 检查 renderer.domElement 的尺寸
|
|
1900
1900
|
const sourceWidth = this.renderer.domElement.width;
|
|
@@ -2167,6 +2167,7 @@ class Controller {
|
|
|
2167
2167
|
this._pawn = null;
|
|
2168
2168
|
this.prepareClickComponent = null;
|
|
2169
2169
|
this.prepareClickHit = null;
|
|
2170
|
+
this.prepareClickModifiers = { ctrlKey: false, shiftKey: false, altKey: false };
|
|
2170
2171
|
this.hoveringComponent = null;
|
|
2171
2172
|
this._pointButtonIsDown = new Set();
|
|
2172
2173
|
this._onClickNothingDelegate = new Delegate();
|
|
@@ -2277,6 +2278,12 @@ class Controller {
|
|
|
2277
2278
|
this.clearClickTimer();
|
|
2278
2279
|
return;
|
|
2279
2280
|
}
|
|
2281
|
+
// 保存修饰键状态
|
|
2282
|
+
this.prepareClickModifiers = {
|
|
2283
|
+
ctrlKey: event.ctrlKey,
|
|
2284
|
+
shiftKey: event.shiftKey,
|
|
2285
|
+
altKey: event.altKey
|
|
2286
|
+
};
|
|
2280
2287
|
if (!this.leftClickTimer) {
|
|
2281
2288
|
this.handleFirstClick();
|
|
2282
2289
|
}
|
|
@@ -2293,7 +2300,7 @@ class Controller {
|
|
|
2293
2300
|
this.leftClickTimer = window.setTimeout(() => {
|
|
2294
2301
|
this.leftClickTimer = null;
|
|
2295
2302
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
2296
|
-
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, false);
|
|
2303
|
+
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, false, this.prepareClickModifiers);
|
|
2297
2304
|
this.prepareClickComponent = null;
|
|
2298
2305
|
this.prepareClickHit = null;
|
|
2299
2306
|
}
|
|
@@ -2306,7 +2313,7 @@ class Controller {
|
|
|
2306
2313
|
handleDoubleClick() {
|
|
2307
2314
|
this.clearClickTimer();
|
|
2308
2315
|
if (this.prepareClickComponent && this.prepareClickHit) {
|
|
2309
|
-
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, true);
|
|
2316
|
+
this.fireClickEvent(this.prepareClickComponent, this.prepareClickHit, true, this.prepareClickModifiers);
|
|
2310
2317
|
}
|
|
2311
2318
|
else {
|
|
2312
2319
|
this._onClickNothingDelegate.broadcast();
|
|
@@ -2314,8 +2321,8 @@ class Controller {
|
|
|
2314
2321
|
this.prepareClickComponent = null;
|
|
2315
2322
|
this.prepareClickHit = null;
|
|
2316
2323
|
}
|
|
2317
|
-
fireClickEvent(component, hit, isDoubleClick) {
|
|
2318
|
-
const event = { component, hit, handled: false };
|
|
2324
|
+
fireClickEvent(component, hit, isDoubleClick, modifiers) {
|
|
2325
|
+
const event = Object.assign({ component, hit, handled: false }, modifiers);
|
|
2319
2326
|
if (isDoubleClick) {
|
|
2320
2327
|
this._onComponentDoubleClickDelegate.broadcast(event);
|
|
2321
2328
|
if (!event.handled) {
|
|
@@ -2351,10 +2358,10 @@ class Controller {
|
|
|
2351
2358
|
const event = { component, hit, button, handled: false };
|
|
2352
2359
|
this._onComponentPointerDownDelegate.broadcast(event);
|
|
2353
2360
|
}
|
|
2354
|
-
onPointerEnterEvent(
|
|
2361
|
+
onPointerEnterEvent(_event) {
|
|
2355
2362
|
this.addCorePointerListeners();
|
|
2356
2363
|
}
|
|
2357
|
-
onPointerLeaveEvent(
|
|
2364
|
+
onPointerLeaveEvent(_event) {
|
|
2358
2365
|
this.removeCorePointerListeners();
|
|
2359
2366
|
}
|
|
2360
2367
|
addCorePointerListeners() {
|
|
@@ -3504,19 +3511,6 @@ class FirstPerson extends Pawn {
|
|
|
3504
3511
|
}
|
|
3505
3512
|
}
|
|
3506
3513
|
|
|
3507
|
-
function debounce(func, delay) {
|
|
3508
|
-
let timeoutId = null;
|
|
3509
|
-
return (...args) => {
|
|
3510
|
-
if (timeoutId) {
|
|
3511
|
-
clearTimeout(timeoutId);
|
|
3512
|
-
}
|
|
3513
|
-
timeoutId = setTimeout(() => {
|
|
3514
|
-
func(...args);
|
|
3515
|
-
timeoutId = null;
|
|
3516
|
-
}, delay);
|
|
3517
|
-
};
|
|
3518
|
-
}
|
|
3519
|
-
|
|
3520
3514
|
class TransformGizmo extends Pawn {
|
|
3521
3515
|
get control() {
|
|
3522
3516
|
if (!this._control) {
|
|
@@ -3594,38 +3588,22 @@ class TransformGizmo extends Pawn {
|
|
|
3594
3588
|
}
|
|
3595
3589
|
}
|
|
3596
3590
|
onObjectChanged() {
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
if (t) {
|
|
3614
|
-
let p2 = new Vector3();
|
|
3615
|
-
let q2 = new Quaternion();
|
|
3616
|
-
let s2 = new Vector3();
|
|
3617
|
-
let TB2 = new Matrix4().multiplyMatrices(TA2, t); // B
|
|
3618
|
-
TB2.decompose(p2, q2, s2);
|
|
3619
|
-
tar.onTransforming(TB2);
|
|
3620
|
-
}
|
|
3621
|
-
}
|
|
3622
|
-
});
|
|
3623
|
-
}
|
|
3624
|
-
if (this.onUpdateFunction) {
|
|
3625
|
-
this.onUpdateFunction();
|
|
3626
|
-
}
|
|
3627
|
-
}, 50);
|
|
3628
|
-
de();
|
|
3591
|
+
if (this.primaryTarget) {
|
|
3592
|
+
this.helperObject.updateMatrixWorld(true);
|
|
3593
|
+
const TA2 = this.helperObject.matrixWorld.clone();
|
|
3594
|
+
this.primaryTarget.onTransforming(TA2);
|
|
3595
|
+
// Apply transform to all additional targets
|
|
3596
|
+
this.targets.forEach((tar, index) => {
|
|
3597
|
+
const relativeMatrix = this.targetMatrixMap.get(tar);
|
|
3598
|
+
if (relativeMatrix) {
|
|
3599
|
+
const TB2 = new Matrix4().multiplyMatrices(TA2, relativeMatrix);
|
|
3600
|
+
tar.onTransforming(TB2);
|
|
3601
|
+
}
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
if (this.onUpdateFunction) {
|
|
3605
|
+
this.onUpdateFunction();
|
|
3606
|
+
}
|
|
3629
3607
|
}
|
|
3630
3608
|
set enable(newEnable) {
|
|
3631
3609
|
this.control.enabled = newEnable;
|
|
@@ -11,6 +11,12 @@ export interface ComponentInteractionEvent {
|
|
|
11
11
|
hit: Intersection;
|
|
12
12
|
/** 设置为 true 阻止组件自身的回调被调用 */
|
|
13
13
|
handled: boolean;
|
|
14
|
+
/** 点击时是否按下 Ctrl 键 */
|
|
15
|
+
ctrlKey: boolean;
|
|
16
|
+
/** 点击时是否按下 Shift 键 */
|
|
17
|
+
shiftKey: boolean;
|
|
18
|
+
/** 点击时是否按下 Alt 键 */
|
|
19
|
+
altKey: boolean;
|
|
14
20
|
}
|
|
15
21
|
/** 组件悬停事件 */
|
|
16
22
|
export interface ComponentHoverEvent {
|
|
@@ -33,6 +39,7 @@ export declare class Controller {
|
|
|
33
39
|
private raycaster;
|
|
34
40
|
private prepareClickComponent;
|
|
35
41
|
private prepareClickHit;
|
|
42
|
+
private prepareClickModifiers;
|
|
36
43
|
private hoveringComponent;
|
|
37
44
|
private _pointButtonIsDown;
|
|
38
45
|
private _onClickNothingDelegate;
|
|
@@ -78,8 +85,8 @@ export declare class Controller {
|
|
|
78
85
|
private clearClickTimer;
|
|
79
86
|
onPointerDownEvent(event: MouseEvent): void;
|
|
80
87
|
private firePointerDownEvent;
|
|
81
|
-
onPointerEnterEvent(
|
|
82
|
-
onPointerLeaveEvent(
|
|
88
|
+
onPointerEnterEvent(_event: MouseEvent): void;
|
|
89
|
+
onPointerLeaveEvent(_event: MouseEvent): void;
|
|
83
90
|
private addCorePointerListeners;
|
|
84
91
|
private removeCorePointerListeners;
|
|
85
92
|
getHitResultUnderCursor(): Intersection | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lythreeframe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.56",
|
|
4
4
|
"description": "Three.js 封装",
|
|
5
5
|
"main": "dist/bundle.cjs.js",
|
|
6
6
|
"module": "dist/bundle.esm.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
23
|
-
"@types/three": "^0.
|
|
23
|
+
"@types/three": "^0.181.0",
|
|
24
24
|
"gsap": "^3.12.2",
|
|
25
25
|
"rollup": "^4.35.0",
|
|
26
|
-
"three": "^0.
|
|
26
|
+
"three": "^0.181.0",
|
|
27
27
|
"tslib": "^2.8.1",
|
|
28
28
|
"typescript": "^5.8.2"
|
|
29
29
|
},
|