Mr.doob 14 лет назад
Родитель
Сommit
caea46444d
3 измененных файлов с 9 добавлено и 19 удалено
  1. 1 11
      src/core/Rectangle.js
  2. 5 5
      src/renderers/CanvasRenderer.js
  3. 3 3
      src/renderers/SVGRenderer.js

+ 1 - 11
src/core/Rectangle.js

@@ -163,17 +163,7 @@ THREE.Rectangle = function () {
 
 	};
 
-	/*
-	this.contains = function ( x, y ) {
-
-		return x > _left && x < _right && y > _top && y < _bottom;
-
-	};
-	*/
-
-	this.instersects = function ( r ) {
-
-		// return this.contains( r.getLeft(), r.getTop() ) || this.contains( r.getRight(), r.getTop() ) || this.contains( r.getLeft(), r.getBottom() ) || this.contains( r.getRight(), r.getBottom() );
+	this.intersects = function ( r ) {
 
 		return Math.min( _right, r.getRight() ) - Math.max( _left, r.getLeft() ) >= 0 &&
 		        Math.min( _bottom, r.getBottom() ) - Math.max( _top, r.getTop() ) >= 0;

+ 5 - 5
src/renderers/CanvasRenderer.js

@@ -222,7 +222,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				_bboxRect.addPoint( _v1.positionScreen.x, _v1.positionScreen.y );
 				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
 
-				if ( _clipRect.instersects( _bboxRect ) ) {
+				if ( _clipRect.intersects( _bboxRect ) ) {
 
 					m = 0; ml = element.materials.length;
 
@@ -256,7 +256,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 						      _v2.positionScreen.x, _v2.positionScreen.y,
 						      _v3.positionScreen.x, _v3.positionScreen.y );
 
-				if ( _clipRect.instersects( _bboxRect ) ) {
+				if ( _clipRect.intersects( _bboxRect ) ) {
 
 					m = 0; ml = element.meshMaterials.length;
 
@@ -313,7 +313,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 				_bboxRect.addPoint( _v3.positionScreen.x, _v3.positionScreen.y );
 				_bboxRect.addPoint( _v4.positionScreen.x, _v4.positionScreen.y );
 
-				if ( _clipRect.instersects( _bboxRect ) ) {
+				if ( _clipRect.intersects( _bboxRect ) ) {
 
 					m = 0; ml = element.meshMaterials.length;
 
@@ -477,7 +477,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 					_bboxRect.set( v1.x - width, v1.y - height, v1.x  + width, v1.y + height );
 
-					if ( !_clipRect.instersects( _bboxRect ) ) {
+					if ( !_clipRect.intersects( _bboxRect ) ) {
 
 						return;
 
@@ -513,7 +513,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 				_bboxRect.set( v1.x - width, v1.y - height, v1.x + width, v1.y + height );
 
-				if ( !_clipRect.instersects( _bboxRect ) ) {
+				if ( !_clipRect.intersects( _bboxRect ) ) {
 
 					return;
 

+ 3 - 3
src/renderers/SVGRenderer.js

@@ -127,7 +127,7 @@ THREE.SVGRenderer = function () {
 				_bboxRect.addPoint( _v1.positionScreen.x, _v1.positionScreen.y );
 				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
 
-				if ( !_clipRect.instersects( _bboxRect ) ) {
+				if ( !_clipRect.intersects( _bboxRect ) ) {
 
 					continue;
 
@@ -154,7 +154,7 @@ THREE.SVGRenderer = function () {
 				_bboxRect.addPoint( _v2.positionScreen.x, _v2.positionScreen.y );
 				_bboxRect.addPoint( _v3.positionScreen.x, _v3.positionScreen.y );
 
-				if ( !_clipRect.instersects( _bboxRect ) ) {
+				if ( !_clipRect.intersects( _bboxRect ) ) {
 
 					continue;
 
@@ -199,7 +199,7 @@ THREE.SVGRenderer = function () {
 				_bboxRect.addPoint( _v3.positionScreen.x, _v3.positionScreen.y );
 				_bboxRect.addPoint( _v4.positionScreen.x, _v4.positionScreen.y );
 
-				if ( !_clipRect.instersects( _bboxRect) ) {
+				if ( !_clipRect.intersects( _bboxRect) ) {
 
 					continue;