Skip to content

Commit 5b3ae8f

Browse files
committed
Add wasIntersected and wasIntersectedOnMouseDown properties to InteractiveEvent
1 parent e4183a8 commit 5b3ae8f

File tree

6 files changed

+38
-25
lines changed

6 files changed

+38
-25
lines changed

README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ Constructor of InteractionManager instance; if the autoAdd option (still beta) i
146146

147147
**Members:**
148148

149-
Member | Type | Default | Description
150-
:----- | :--- | :------ | :----------
151-
`treatTouchEventsAsMouseEvents` | boolean | true | Whether touch events should fire as mouse events
149+
| Member | Type |  Default |  Description |
150+
| :------------------------------ | :------ | :------- | :----------------------------------------------- |
151+
| `treatTouchEventsAsMouseEvents` | boolean | true | Whether touch events should fire as mouse events |
152152

153153
**Methods:**
154154

155-
Method | Description
156-
:----- | :----------
157-
`add(object, childNames = [])` | Add object(s), optionally select only children of `object` by their names
158-
`remove(object, childNames = [])` | Remove object(s), optionally select only children of `object` by their names
159-
`update()` | Update InteractionManager on each render
160-
`dispose()` | Dispose InteractionManager
155+
| Method | Description |
156+
| :-------------------------------- | :--------------------------------------------------------------------------- |
157+
| `add(object, childNames = [])` | Add object(s), optionally select only children of `object` by their names |
158+
| `remove(object, childNames = [])` | Remove object(s), optionally select only children of `object` by their names |
159+
| `update()` | Update InteractionManager on each render |
160+
| `dispose()` | Dispose InteractionManager |
161161

162162
#### InteractionManagerOptions class
163163

@@ -169,21 +169,23 @@ Constructor of InteractionManagerOptions instance
169169

170170
**Members:**
171171

172-
Member | Type | Default | Description
173-
:----- | :--- | :------ | :----------
174-
`cancelBubble` | boolean | false | Whether events should continue to bubble
175-
`coords` | THREE.Vector2 | | Mouse/touch coords
176-
`distance` | Number | | Distance of intersected point from camera
177-
`intersected` | boolean | | Whether object is still intersected
178-
`originalEvent` | Event object | | Original event, if available (MouseEvent, TouchEvent or PointerEvent)
179-
`target` | THREE.Object3D | | Target object
180-
`type` | string | |event type: 'click', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'mousedown', 'mousemove', 'mouseup', 'touchstart', 'touchmove', 'touchend', 'pointerdown', 'pointerup', 'pointermove'
172+
| Member | Type |  Default |  Description |
173+
| :-------------------------- | :------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
174+
| `cancelBubble` | boolean | false | Whether events should continue to bubble |
175+
| `coords` | THREE.Vector2 | | Mouse/touch coords |
176+
| `distance` | Number | | Distance of intersected point from camera |
177+
| `intersected` | boolean | | Whether object is still intersected |
178+
| `wasIntersected` | boolean | | Whether object was intersected during the last event or last render |
179+
| `wasIntersectedOnMouseDown` | boolean | | Whether object was intersected during mousedown event |
180+
| `originalEvent` | Event object | | Original event, if available (MouseEvent, TouchEvent or PointerEvent) |
181+
| `target` | THREE.Object3D | | Target object |
182+
| `type` | string | | event type: 'click', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'mousedown', 'mousemove', 'mouseup', 'touchstart', 'touchmove', 'touchend', 'pointerdown', 'pointerup', 'pointermove' |
181183

182184
**Methods:**
183185

184-
Method | Description
185-
:----- | :----------
186-
`stopPropagation` | Stop bubbling of event (cancelBubble), e.g. when only the object closest to the camera is supposed to fire an event
186+
| Method | Description |
187+
| :---------------- | :------------------------------------------------------------------------------------------------------------------ |
188+
| `stopPropagation` | Stop bubbling of event (cancelBubble), e.g. when only the object closest to the camera is supposed to fire an event |
187189

188190
### Editing source
189191

build/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export declare class InteractiveObject {
44
name: string;
55
intersected: boolean;
66
wasIntersected: boolean;
7+
wasIntersectedOnMouseDown: boolean;
78
distance: number;
89
constructor(target: THREE.Object3D, name: string);
910
}
@@ -14,6 +15,8 @@ export declare class InteractiveEvent {
1415
coords: Vector2;
1516
distance: number;
1617
intersected: boolean;
18+
wasIntersected: boolean;
19+
wasIntersectedOnMouseDown: boolean;
1720
constructor(type: string, originalEvent?: Event | null);
1821
stopPropagation(): void;
1922
}

0 commit comments

Comments
 (0)