提交 a8080659 编写于 作者: M Mugen87

Examples: Rename DragControls example.

上级 81463ef1
...@@ -52,7 +52,6 @@ var files = { ...@@ -52,7 +52,6 @@ var files = {
"webgl_interactive_cubes_gpu", "webgl_interactive_cubes_gpu",
"webgl_interactive_instances_gpu", "webgl_interactive_instances_gpu",
"webgl_interactive_cubes_ortho", "webgl_interactive_cubes_ortho",
"webgl_interactive_draggablecubes",
"webgl_interactive_lines", "webgl_interactive_lines",
"webgl_interactive_points", "webgl_interactive_points",
"webgl_interactive_raycasting_points", "webgl_interactive_raycasting_points",
...@@ -360,6 +359,7 @@ var files = { ...@@ -360,6 +359,7 @@ var files = {
"misc_animation_keys", "misc_animation_keys",
"misc_boxselection", "misc_boxselection",
"misc_controls_deviceorientation", "misc_controls_deviceorientation",
"misc_controls_drag",
"misc_controls_fly", "misc_controls_fly",
"misc_controls_map", "misc_controls_map",
"misc_controls_orbit", "misc_controls_orbit",
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>three.js webgl - draggable cubes</title> <title>three.js webgl - drag controls</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css"> <link type="text/css" rel="stylesheet" href="main.css">
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<body> <body>
<div id="info"> <div id="info">
<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - draggable cubes <a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - drag controls
</div> </div>
<script type="module"> <script type="module">
...@@ -27,11 +27,10 @@ ...@@ -27,11 +27,10 @@
import Stats from './jsm/libs/stats.module.js'; import Stats from './jsm/libs/stats.module.js';
import { TrackballControls } from './jsm/controls/TrackballControls.js';
import { DragControls } from './jsm/controls/DragControls.js'; import { DragControls } from './jsm/controls/DragControls.js';
var container, stats; var container, stats;
var camera, controls, scene, renderer; var camera, scene, renderer;
var objects = []; var objects = [];
init(); init();
...@@ -98,24 +97,17 @@ ...@@ -98,24 +97,17 @@
container.appendChild( renderer.domElement ); container.appendChild( renderer.domElement );
controls = new TrackballControls( camera, renderer.domElement ); var controls = new DragControls( objects, camera, renderer.domElement );
controls.rotateSpeed = 1.0;
controls.zoomSpeed = 1.2;
controls.panSpeed = 0.8;
controls.noZoom = false;
controls.noPan = false;
controls.staticMoving = true;
controls.dynamicDampingFactor = 0.3;
var dragControls = new DragControls( objects, camera, renderer.domElement ); controls.addEventListener( 'dragstart', function ( event ) {
dragControls.addEventListener( 'dragstart', function () {
controls.enabled = false; event.object.material.emissive.set( 0xaaaaaa );
} ); } );
dragControls.addEventListener( 'dragend', function () {
controls.enabled = true; controls.addEventListener( 'dragend', function ( event ) {
event.object.material.emissive.set( 0x000000 );
} ); } );
...@@ -150,8 +142,6 @@ ...@@ -150,8 +142,6 @@
function render() { function render() {
controls.update();
renderer.render( scene, camera ); renderer.render( scene, camera );
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册