remove MouseControl
This commit is contained in:
parent
b616ce8cf2
commit
58a9df63bf
|
|
@ -37,10 +37,10 @@ Three.js powered Minecraft skin viewer.
|
||||||
skinViewer.height = 400;
|
skinViewer.height = 400;
|
||||||
|
|
||||||
// Control objects with your mouse!
|
// Control objects with your mouse!
|
||||||
let control = new skinview3d.SkinControl(skinViewer);
|
let control = skinview3d.createOrbitControls(skinViewer);
|
||||||
control.rotation = true;
|
control.enableRotate = true;
|
||||||
control.zoom = false;
|
control.enableZoom = false;
|
||||||
control.pan = false;
|
control.enablePan = false;
|
||||||
|
|
||||||
skinViewer.animation = new skinview3d.CompositeAnimation();
|
skinViewer.animation = new skinview3d.CompositeAnimation();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -593,4 +593,17 @@ class OrbitControls extends THREE.EventDispatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { OrbitControls };
|
function createOrbitControls(skinViewer) {
|
||||||
|
let control = new OrbitControls(skinViewer.camera, skinViewer.renderer.domElement);
|
||||||
|
|
||||||
|
// default configuration
|
||||||
|
control.enablePan = false;
|
||||||
|
control.target = new THREE.Vector3(0, -12, 0);
|
||||||
|
control.minDistance = 10;
|
||||||
|
control.maxDistance = 256;
|
||||||
|
control.update();
|
||||||
|
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { OrbitControls, createOrbitControls };
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
export { SkinObject, CapeObject, PlayerObject } from "./model";
|
export { SkinObject, CapeObject, PlayerObject } from "./model";
|
||||||
export { SkinViewer, MouseControl } from "./viewer";
|
export { SkinViewer } from "./viewer";
|
||||||
|
export { OrbitControls, createOrbitControls } from "./orbit_controls";
|
||||||
export {
|
export {
|
||||||
invokeAnimation,
|
invokeAnimation,
|
||||||
CompositeAnimation,
|
CompositeAnimation,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import * as THREE from "three";
|
import * as THREE from "three";
|
||||||
import { PlayerObject } from "./model";
|
import { PlayerObject } from "./model";
|
||||||
import { OrbitControls } from "./orbit_controls";
|
|
||||||
import { invokeAnimation } from "./animation";
|
import { invokeAnimation } from "./animation";
|
||||||
|
|
||||||
function copyImage(context, sX, sY, w, h, dX, dY, flipHorizontal) {
|
function copyImage(context, sX, sY, w, h, dX, dY, flipHorizontal) {
|
||||||
|
|
@ -228,45 +227,4 @@ class SkinViewer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MouseControl {
|
export { SkinViewer };
|
||||||
constructor(skinViewer) {
|
|
||||||
this.skinViewer = skinViewer;
|
|
||||||
|
|
||||||
this.orbitControls = new OrbitControls(skinViewer.camera, skinViewer.renderer.domElement);
|
|
||||||
this.orbitControls.enablePan = false;
|
|
||||||
this.orbitControls.target = new THREE.Vector3(0, -12, 0);
|
|
||||||
this.orbitControls.minDistance = 10;
|
|
||||||
this.orbitControls.maxDistance = 256;
|
|
||||||
this.orbitControls.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
get rotation() {
|
|
||||||
return this.orbitControls.enableRotate;
|
|
||||||
}
|
|
||||||
|
|
||||||
set rotation(value) {
|
|
||||||
this.orbitControls.enableRotate = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
get zoom() {
|
|
||||||
return this.orbitControls.enableZoom;
|
|
||||||
}
|
|
||||||
|
|
||||||
set zoom(value) {
|
|
||||||
this.orbitControls.enableZoom = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
get pan() {
|
|
||||||
return this.orbitControls.enablePan;
|
|
||||||
}
|
|
||||||
|
|
||||||
set pan(value) {
|
|
||||||
this.orbitControls.enablePan = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispose() {
|
|
||||||
this.orbitControls.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { SkinViewer, MouseControl };
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue