@xviewer.js/core 1.0.4-alpha.6 → 1.0.4-alpha.8
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/main.cjs +116 -22
- package/dist/main.cjs.map +1 -1
- package/dist/module.js +116 -22
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/DeviceInput.d.ts +20 -1
- package/types/Viewer.d.ts +2 -2
package/package.json
CHANGED
package/types/DeviceInput.d.ts
CHANGED
|
@@ -7,6 +7,15 @@ export interface InputTarget {
|
|
|
7
7
|
removeEventListener?(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
8
8
|
addEventListener?(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
9
9
|
}
|
|
10
|
+
export interface InputOption {
|
|
11
|
+
source: HTMLElement | Document;
|
|
12
|
+
normalizeWheel?: (e: WheelEvent) => {
|
|
13
|
+
spinX: number;
|
|
14
|
+
spinY: number;
|
|
15
|
+
pixelX: number;
|
|
16
|
+
pixelY: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
10
19
|
export declare class DeviceInput extends Component {
|
|
11
20
|
static readonly CLICK = "click";
|
|
12
21
|
static readonly MOUSE_WHEEL = "mousewheel";
|
|
@@ -22,14 +31,18 @@ export declare class DeviceInput extends Component {
|
|
|
22
31
|
static readonly KEYPRESS = "keypress";
|
|
23
32
|
static readonly KEYUP = "keyup";
|
|
24
33
|
private _target;
|
|
34
|
+
private _normalizeWheel;
|
|
25
35
|
private _listeners;
|
|
26
36
|
private _touches;
|
|
27
37
|
private _touchCount;
|
|
38
|
+
private _touchStart;
|
|
39
|
+
private _touchMoving;
|
|
28
40
|
private _pointer;
|
|
29
41
|
private _pointerPixel;
|
|
30
42
|
private _pointerButton;
|
|
31
43
|
private _prePointer;
|
|
32
44
|
private _prePointerPixel;
|
|
45
|
+
private _preTouches;
|
|
33
46
|
private _mouseWheel;
|
|
34
47
|
private _keys;
|
|
35
48
|
private _pressability;
|
|
@@ -38,7 +51,13 @@ export declare class DeviceInput extends Component {
|
|
|
38
51
|
get pointerButton(): number;
|
|
39
52
|
get prePointer(): Vector2;
|
|
40
53
|
get prePointerPixel(): Vector2;
|
|
54
|
+
get preTouches(): {
|
|
55
|
+
id: number;
|
|
56
|
+
position: Vector2;
|
|
57
|
+
}[];
|
|
41
58
|
get mouseWheel(): number;
|
|
59
|
+
get touchStart(): boolean;
|
|
60
|
+
get touchMoving(): boolean;
|
|
42
61
|
get touchCount(): number;
|
|
43
62
|
get touches(): {
|
|
44
63
|
id: number;
|
|
@@ -47,7 +66,7 @@ export declare class DeviceInput extends Component {
|
|
|
47
66
|
get keys(): {
|
|
48
67
|
[k: string]: boolean;
|
|
49
68
|
};
|
|
50
|
-
constructor(
|
|
69
|
+
constructor(option: InputOption);
|
|
51
70
|
onEnable(): void;
|
|
52
71
|
onDisable(): void;
|
|
53
72
|
lastUpdate(dt: number): void;
|
package/types/Viewer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BufferGeometry, Camera, Color, ColorRepresentation, ColorSpace, DataTexture, LoadingManager, Material, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, Scene, ShaderMaterial, ShadowMapType, Texture, TextureDataType, ToneMapping, Vector3, WebGLCubeRenderTarget, WebGLRenderer, WebGLRendererParameters, WebGLRenderTarget } from "three";
|
|
2
2
|
import { EventEmitter } from "./base";
|
|
3
3
|
import { ComponentManager } from "./ComponentManager";
|
|
4
|
-
import { DeviceInput } from "./DeviceInput";
|
|
4
|
+
import { DeviceInput, InputOption } from "./DeviceInput";
|
|
5
5
|
import { Orientation, ResizeMode } from "./enums";
|
|
6
6
|
import { AssetProperties, LoaderConstructor } from "./asset/ResourceManager";
|
|
7
7
|
import { __C, __P, __Properties } from "./types";
|
|
@@ -72,7 +72,7 @@ export declare class Viewer extends EventEmitter {
|
|
|
72
72
|
/** 渲染用的 canvas 元素,如果不提供,默认获取 id 为 "canvas" 的元素 */
|
|
73
73
|
canvas?: HTMLCanvasElement;
|
|
74
74
|
/** 设备输入容器,默认使用canvas */
|
|
75
|
-
input?:
|
|
75
|
+
input?: InputOption;
|
|
76
76
|
/** 是否开启阴影或阴影类型,true/false 表示默认 PCFSoftShadowMap */
|
|
77
77
|
shadows?: boolean | ShadowMapType;
|
|
78
78
|
/** 渲染是否开启排序,默认 True */
|