Przeglądaj źródła

Editor: Moved THREE.HTML code out of html2canvas.js

Mr.doob 9 lat temu
rodzic
commit
32414584b3
3 zmienionych plików z 76 dodań i 74 usunięć
  1. 1 0
      editor/index.html
  2. 0 74
      editor/js/libs/html2canvas.js
  3. 75 0
      editor/js/libs/three.html.js

+ 1 - 0
editor/index.html

@@ -154,6 +154,7 @@
 		<!-- <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="qyqgfqd9j8z890t"></script> -->
 
 		<script src="js/libs/html2canvas.js"></script>
+		<script src="js/libs/three.html.js"></script>
 
 		<script>
 

+ 0 - 74
editor/js/libs/html2canvas.js

@@ -187,77 +187,3 @@ function html2canvas( element ) {
 	return canvas;
 
 }
-
-//
-
-THREE.HTMLGroup = function ( dom ) {
-
-	THREE.Group.call( this );
-
-	this.type = 'HTMLGroup';
-
-	/*
-	dom.addEventListener( 'mousemove', function ( event ) {
-
-		console.log( 'mousemove' );
-
-	} );
-
-	dom.addEventListener( 'click', function ( event ) {
-
-		console.log( 'click' );
-
-	} );
-	*/
-
-};
-
-THREE.HTMLGroup.prototype = Object.assign( Object.create( THREE.Group.prototype ), {
-
-	constructor: THREE.HTMLGroup
-
-} );
-
-THREE.HTMLMesh = function ( dom ) {
-
-	var texture = new THREE.HTMLTexture( dom );
-
-	var geometry = new THREE.PlaneGeometry( texture.image.width * 0.05, texture.image.height * 0.05 );
-	var material = new THREE.MeshBasicMaterial( { map: texture } );
-
-	THREE.Mesh.call( this, geometry, material );
-
-	this.type = 'HTMLMesh';
-
-};
-
-THREE.HTMLMesh.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), {
-
-	constructor: THREE.HTMLMesh
-
-} );
-
-THREE.HTMLTexture = function ( dom ) {
-
-	THREE.CanvasTexture.call( this, html2canvas( dom ) );
-
-	this.dom = dom;
-
-	this.anisotropy = 16;
-
-};
-
-THREE.HTMLTexture.prototype = Object.assign( Object.create( THREE.CanvasTexture.prototype ), {
-
-	constructor: THREE.HTMLTexture,
-
-	update: function () {
-
-		console.log( 'yo!', this, this.dom );
-
-		this.image = html2canvas( this.dom );
-		this.needsUpdate = true;
-
-	}
-
-} );

+ 75 - 0
editor/js/libs/three.html.js

@@ -0,0 +1,75 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+ THREE.HTMLGroup = function ( dom ) {
+
+ 	THREE.Group.call( this );
+
+ 	this.type = 'HTMLGroup';
+
+ 	/*
+ 	dom.addEventListener( 'mousemove', function ( event ) {
+
+ 		console.log( 'mousemove' );
+
+ 	} );
+
+ 	dom.addEventListener( 'click', function ( event ) {
+
+ 		console.log( 'click' );
+
+ 	} );
+ 	*/
+
+ };
+
+ THREE.HTMLGroup.prototype = Object.assign( Object.create( THREE.Group.prototype ), {
+
+ 	constructor: THREE.HTMLGroup
+
+ } );
+
+ THREE.HTMLMesh = function ( dom ) {
+
+ 	var texture = new THREE.HTMLTexture( dom );
+
+ 	var geometry = new THREE.PlaneGeometry( texture.image.width * 0.05, texture.image.height * 0.05 );
+ 	var material = new THREE.MeshBasicMaterial( { map: texture } );
+
+ 	THREE.Mesh.call( this, geometry, material );
+
+ 	this.type = 'HTMLMesh';
+
+ };
+
+ THREE.HTMLMesh.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), {
+
+ 	constructor: THREE.HTMLMesh
+
+ } );
+
+ THREE.HTMLTexture = function ( dom ) {
+
+ 	THREE.CanvasTexture.call( this, html2canvas( dom ) );
+
+ 	this.dom = dom;
+
+ 	this.anisotropy = 16;
+
+ };
+
+ THREE.HTMLTexture.prototype = Object.assign( Object.create( THREE.CanvasTexture.prototype ), {
+
+ 	constructor: THREE.HTMLTexture,
+
+ 	update: function () {
+
+ 		console.log( 'yo!', this, this.dom );
+
+ 		this.image = html2canvas( this.dom );
+ 		this.needsUpdate = true;
+
+ 	}
+
+ } );