Comparing version 0.0.4 to 0.0.5
@@ -41,2 +41,29 @@ 'use strict'; | ||
reactThreeFiber.extend({ | ||
MapControls: OrbitControls$1.MapControls | ||
}); | ||
function MapControls(props) { | ||
if (props === void 0) { | ||
props = { | ||
enableDamping: true, | ||
dampingFactor: 0.05, | ||
screenSpacePanning: false | ||
}; | ||
} | ||
var controls = React.useRef(); | ||
var _useThree = reactThreeFiber.useThree(), | ||
camera = _useThree.camera, | ||
gl = _useThree.gl; | ||
reactThreeFiber.useFrame(function () { | ||
return controls.current && controls.current.update(); | ||
}); | ||
return /*#__PURE__*/React__default.createElement("mapControls", _extends({ | ||
ref: controls, | ||
args: [camera, gl.domElement] | ||
}, props)); | ||
} | ||
function draco(url) { | ||
@@ -54,3 +81,4 @@ if (url === void 0) { | ||
exports.MapControls = MapControls; | ||
exports.OrbitControls = OrbitControls; | ||
exports.draco = draco; |
export * from './OrbitControls'; | ||
export * from './MapControls'; | ||
export * from './draco'; |
import _extends from '@babel/runtime/helpers/esm/extends'; | ||
import React, { useRef } from 'react'; | ||
import { extend, useThree, useFrame } from 'react-three-fiber'; | ||
import { OrbitControls as OrbitControls$1 } from 'three/examples/jsm/controls/OrbitControls'; | ||
import { OrbitControls as OrbitControls$1, MapControls as MapControls$1 } from 'three/examples/jsm/controls/OrbitControls'; | ||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; | ||
@@ -27,2 +27,22 @@ | ||
extend({ | ||
MapControls: MapControls$1 | ||
}); | ||
function MapControls(props = { | ||
enableDamping: true, | ||
dampingFactor: 0.05, | ||
screenSpacePanning: false | ||
}) { | ||
const controls = useRef(); | ||
const { | ||
camera, | ||
gl | ||
} = useThree(); | ||
useFrame(() => controls.current && controls.current.update()); | ||
return /*#__PURE__*/React.createElement("mapControls", _extends({ | ||
ref: controls, | ||
args: [camera, gl.domElement] | ||
}, props)); | ||
} | ||
function draco(url = '/draco-gltf/') { | ||
@@ -36,2 +56,2 @@ return loader => { | ||
export { OrbitControls, draco }; | ||
export { MapControls, OrbitControls, draco }; |
{ | ||
"name": "drei", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "useful add-ons for react-three-fiber", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -1,12 +0,19 @@ | ||
[![Build Status](https://travis-ci.org/drcmda/drei.svg?branch=master)](https://travis-ci.org/drcmda/drei) [![npm version](https://badge.fury.io/js/drei.svg)](https://badge.fury.io/js/drei) ![npm](https://img.shields.io/npm/dt/drei.svg) | ||
[![Build Status](https://travis-ci.org/react-spring/drei.svg?branch=master)](https://travis-ci.org/react-spring/drei) [![npm version](https://badge.fury.io/js/drei.svg)](https://badge.fury.io/js/drei) ![npm](https://img.shields.io/npm/dt/drei.svg) | ||
This is a collection of useful helpers and abstractions for [react-three-fiber](https://github.com/react-spring/react-three-fiber), saving you some boilerplate. | ||
**PR's are more than welcome!** If you find yourself repeating set-up code often and if it's generic enough to be useful, add it here, everyone benefits. | ||
<br /> | ||
npm install drei | ||
yarn add drei | ||
```jsx | ||
import { ... } from 'drei' | ||
``` | ||
<br /> | ||
- [x] OrbitControls, `<OrbitControls enableDamping ... />` | ||
- [x] MapControls, `<MapControls enableDamping ... />` | ||
- [x] draco, `useLoader(GLTFLoader, url, draco())` |
export * from './OrbitControls' | ||
export * from './MapControls' | ||
export * from './draco' |
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
14851
16
340
20