Skip to content

Commit

Permalink
Updated documentation and version
Browse files Browse the repository at this point in the history
  • Loading branch information
SaFrMo committed Jan 29, 2019
1 parent 80357cf commit 415f47f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,40 @@ export default {

### Constructor

Defaults shown.

```js
new Raycaster({
// the area to check on mouseover
el: document.querySelector('canvas'),

// the camera that will be doing the raycasting
camera: null,

// whether or not to print debug messages
debug: false,

// raycaster (optional - will create automatically if not specified)
raycaster: null
})
```

### Properties

| Name | Type | Notes |
| ------------- | ------ | ------------------------------------------------------- |
| interpolatedX | Number | The normalized relative mouse X position, from -1 to 1. |
| interpolatedY | Number | The normalized relative mouse Y position, from -1 to 1. |
| mouseX | Number | The latest mouseX position relative to the container. |
| mouseY | Number | The latest mouseY position relative to the container. |

### Methods

| Name | Arguments | Notes |
| ---------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| init | options (same as constructor) | Initializes this raycaster. Same method as called by constructor. |
| updateMouse | mouse event | Updates relative mouse coordinates. Called internally. |
| cast | `{ coordinates: { x: Number, y: Number }, camera: THREE.Camera }` | Raycast and save the results internally. If `coordinates` are unspecified, uses the last coordinates set by `updateMouse`. If `camera` is unspecified, uses the camera added during instantiation. |
| intersectObject | (object, recursive, optionalTarget, coordinates, camera) | Calls `cast()` with the given `coordinates` and `camera`, then runs [intersectObject](https://threejs.org/docs/index.html#api/en/core/Raycaster.intersectObject) with the first three arguments. |
| intersectObjects | (objects, recursive, optionalTarget, coordinates, camera) | Calls `cast()` with the given `coordinates` and `camera`, then runs [intersectObjects](https://threejs.org/docs/index.html#api/en/core/Raycaster.intersectObjects) with the first three arguments. |
| destroy | None | Destroys the event listener created during `init`. |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-three-wrap",
"version": "2.0.1",
"version": "3.0.0",
"description": "Bare-bones Vue component wrapping a THREE.js instance.",
"main": "./dist/vue-three-wrap.common.js",
"scripts": {
Expand Down
2 changes: 0 additions & 2 deletions src/extras/raycaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export default class {
this.interpolatedY = interpolate([0, clientRect.height], [1, -1])(
this.mouseY
)

// console.log(this.interpolatedX, this.interpolatedY)
}

cast(coordinates = null, camera = null) {
Expand Down

0 comments on commit 415f47f

Please sign in to comment.