three-render-objects
Advanced tools
Comparing version 1.16.0 to 1.17.0
@@ -310,4 +310,2 @@ 'use strict'; | ||
var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; | ||
// based on https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24 | ||
var camera = state.camera; | ||
@@ -318,3 +316,9 @@ for (var _len = arguments.length, bboxArgs = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { | ||
var bbox = this.getBbox.apply(this, bboxArgs); | ||
return this.fitToBbox(this.getBbox.apply(this, bboxArgs), transitionDuration, padding); | ||
}, | ||
fitToBbox: function fitToBbox(state, bbox) { | ||
var transitionDuration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var padding = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10; | ||
// based on https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24 | ||
var camera = state.camera; | ||
@@ -321,0 +325,0 @@ if (bbox) { |
@@ -45,2 +45,3 @@ import { WebGLRendererParameters, Object3D, WebGLRenderer, Scene, Camera } from 'three'; | ||
zoomToFit(durationMs?: number, padding?: number, objFilter?: (obj: Object3D) => boolean): ChainableInstance; | ||
fitToBbox(bbox: { x: [number, number], y: [number, number], z: [number, number] }, durationMs?: number, padding?: number): ChainableInstance; | ||
postProcessingComposer(): EffectComposer; | ||
@@ -47,0 +48,0 @@ renderer(): WebGLRenderer; |
@@ -306,4 +306,2 @@ import { WebGLRenderer, Scene, PerspectiveCamera, Raycaster, TextureLoader, Vector2, Vector3, Box3, Color, Mesh, SphereGeometry, MeshBasicMaterial, BackSide, EventDispatcher, MOUSE, Quaternion, Spherical, Clock } from 'three'; | ||
var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10; | ||
// based on https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24 | ||
var camera = state.camera; | ||
@@ -314,3 +312,9 @@ for (var _len = arguments.length, bboxArgs = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { | ||
var bbox = this.getBbox.apply(this, bboxArgs); | ||
return this.fitToBbox(this.getBbox.apply(this, bboxArgs), transitionDuration, padding); | ||
}, | ||
fitToBbox: function fitToBbox(state, bbox) { | ||
var transitionDuration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
var padding = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10; | ||
// based on https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24 | ||
var camera = state.camera; | ||
@@ -317,0 +321,0 @@ if (bbox) { |
{ | ||
"name": "three-render-objects", | ||
"version": "1.16.0", | ||
"version": "1.17.0", | ||
"description": "Easy way to render ThreeJS objects with built-in interaction defaults", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -74,2 +74,3 @@ three-render-objects | ||
| <b>zoomToFit</b>([<i>ms</i>], [<i>px</i>], [<i>objFilterFn</i>]) | Automatically moves the camera so that all of the objects in the scene become visible within its field of view, while aiming at the scene center (0,0,0). If no objects are found no action is taken. It accepts three optional arguments: the first defines the duration of the transition (in ms) to animate the camera motion (default: 0ms). The second argument is the amount of padding (in px) between the edge of the canvas and the outermost object position (default: 10px). The third argument specifies a custom object filter: `obj => <boolean>`, which should return a truthy value if the object is to be included. This can be useful for focusing on a portion of the scene. | `(0, 10, obj => true)` | | ||
| <b>fitToBbox</b>(<i>bbox</i>, [<i>ms</i>], [<i>px</i>], [<i>objFilterFn</i>]) | Automatically moves the camera to fit the specified bounding box within its field of view, while aiming at the scene center (0,0,0). The bounding box should follow the syntax `{ x: [<num>, <num>], y: [<num>, <num>], z: [<num>, <num>] }`. If no bounding box is specified no action is taken. It accepts two optional arguments: the first defines the duration of the transition (in ms) to animate the camera motion (default: 0ms). The second argument is the amount of padding (in px) between the edge of the canvas and the outermost object position (default: 10px). | `(0, 10)` | | ||
| <b>postProcessingComposer</b>() | Access the [post-processing composer](https://threejs.org/docs/#examples/en/postprocessing/EffectComposer). Use this to add post-processing [rendering effects](https://github.com/mrdoob/three.js/tree/dev/examples/jsm/postprocessing) to the scene. By default the composer has a single pass ([RenderPass](https://github.com/mrdoob/three.js/blob/dev/examples/jsm/postprocessing/RenderPass.js)) that directly renders the scene without any effects. || | ||
@@ -76,0 +77,0 @@ | <b>renderer</b>() | Access the [WebGL renderer](https://threejs.org/docs/#api/renderers/WebGLRenderer) object. || |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5106065
37263
107